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

@dcdillon dcdillon commented Dec 31, 2016

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>

This comment has been minimized.

@eddelbuettel

eddelbuettel Jan 3, 2017
Owner

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

namespace detail {

namespace {
namespace RcppCCTZ {

This comment has been minimized.

@eddelbuettel

eddelbuettel Jan 3, 2017
Owner

And maybe keep the existing namespace?

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

This comment has been minimized.

@eddelbuettel

eddelbuettel Jan 3, 2017
Owner

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__

This comment has been minimized.

@eddelbuettel

eddelbuettel Jan 6, 2017
Owner

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);

This comment has been minimized.

@eddelbuettel

eddelbuettel Jan 6, 2017
Owner

That's a better namespace -- +1

@dcdillon
Copy link
Contributor Author

@dcdillon dcdillon commented Jan 6, 2017

Lol read the commit comment

@eddelbuettel
Copy link
Owner

@eddelbuettel eddelbuettel commented Jan 6, 2017

Ouch. Damn ipOverPower messing with you?

…Removed testing ode.
@eddelbuettel
Copy link
Owner

@eddelbuettel eddelbuettel commented Jan 6, 2017

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 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
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.