Skip to content

Conversation

@Joseph-Edwards
Copy link
Collaborator

This PR adds some tests of the default values of ToddCoxeter settings, and also the type of datetime object some functions return.

@Joseph-Edwards
Copy link
Collaborator Author

This PR should hopefully highlight the issues described in #320.

@Joseph-Edwards
Copy link
Collaborator Author

I was hoping it would be possible to implicitly between std::chrono::high_resolution_clock::time_point and std::chrono::system_clock::time_point, but that doesn't seem to be the case. I'll look into this further.

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();
Copy link
Member

@james-d-mitchell james-d-mitchell Sep 15, 2025

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?

Copy link
Collaborator Author

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.

Copy link
Member

@james-d-mitchell james-d-mitchell left a 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!

@Joseph-Edwards Joseph-Edwards merged commit d121ce4 into libsemigroups:main Sep 22, 2025
13 checks passed
@Joseph-Edwards Joseph-Edwards deleted the test-types branch September 22, 2025 20:23
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.

2 participants