-
Notifications
You must be signed in to change notification settings - Fork 10
Test default values and datetime types
#324
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
Test default values and datetime types
#324
Conversation
|
This PR should hopefully highlight the issues described in #320. |
ece4320 to
4d3c5ce
Compare
68c793a to
cddc994
Compare
|
I was hoping it would be possible to implicitly between |
src/runner.cpp
Outdated
| system_clock::time_point to_system(TimePoint tp) { | ||
| // Account for the difference between system_clock and | ||
| // high_resolution_clock | ||
| auto sys_now = system_clock::now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this does what you want, the time at which line 58 is executed isn't the same as the time at which 59 is executed, so what are you measuring here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function was very heavily influenced by the discussion on this Convert between C++ Clocks stack overflow question.
Whilst the times between line 58 and 59 won't be exactly the same, the testing done in that stack overflow thread showed that the error in conversion is on the order of magnitude of hundreds of nanoseconds. Since Python's datetime module works with microsecond precision, this error seemed acceptable.
That stack overflow thread goes on to explain a method that yields time conversions where the error is on the order of magnitude of one nanosecond. I'm happy to implement that if that level of error is desired.
james-d-mitchell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good, although there are a few things I don't understand exactly, if you could address those, then that'd be great!
This PR adds some tests of the default values of
ToddCoxetersettings, and also the type ofdatetimeobject some functions return.