Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::get_time and strptime for the truly unfortunate. (Closes #9) #11

Merged
merged 12 commits into from
Jan 7, 2017

Conversation

dcdillon
Copy link
Contributor

This adds a backport of std::get_time (in the std_backports namespace) and shores up the strptime() implementation based on std::get_time.

Windows here we come!

@dcdillon dcdillon changed the title std::get_time and strptime for the truly unfortunate. std::get_time and strptime for the truly unfortunate. (Closes #9) Dec 31, 2016
@@ -31,27 +31,43 @@
#if !HAS_STRPTIME
#include <iomanip>
#include <sstream>
#include <get_time.h>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make the include conditional on being compiled with MinGW? Just to minimise side-effects...

namespace detail {

namespace {
namespace RcppCCTZ {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe keep the existing namespace?

#else
dp = strptime(dp, fmt, tm);
#endif
dp = RcppCCTZ::strptime(dp, fmt, tm);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe standard strptime() most of the time and our if and when we have no alternative?

… my desk to my bedroom because my network isn't quite right.
@@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#define __MINGW64__
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That one probably needs to go eventually.

@@ -516,7 +523,7 @@ const char* ParseSubSeconds(const char* dp,
// Parses a string into a std::tm using strptime(3).
const char* ParseTM(const char* dp, const char* fmt, std::tm* tm) {
if (dp != nullptr) {
dp = RcppCCTZ::strptime(dp, fmt, tm);
dp = cctz::detail::strptime(dp, fmt, tm);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a better namespace -- +1

@dcdillon
Copy link
Contributor Author

dcdillon commented Jan 6, 2017

Lol read the commit comment

@eddelbuettel
Copy link
Owner

Ouch. Damn ipOverPower messing with you?

@eddelbuettel
Copy link
Owner

I am not sure I like the last change set. I don;t think I want to change away from %F %T by default. I'd rather condition.

But it looks like you have a build failure to catch anyway?

@dcdillon
Copy link
Contributor Author

dcdillon commented Jan 6, 2017

Gotcha...no more time tonight. Will have to address in the morning. For now, everything should work correctly on every platform.

@eddelbuettel eddelbuettel merged commit de8629f into eddelbuettel:master Jan 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants