corsis / clock

High-resolution clock functions: monotonic, realtime, cputime.
Other
58 stars 25 forks source link

Fix/extend tests, move Seconds into separate module #69

Closed Mathnerd314 closed 2 years ago

Mathnerd314 commented 3 years ago

This changes the signum function for TimeSpec to match the multiplication. Also Seconds is moved into a separate module, so that the various functions can be re-exported with Seconds type. I had to export normalize and s2ns but people doing complicated things with the TimeSpec type will probably need them.

I also extended the tests a lot, amazingly they all pass. They don't pass if you change arbitrarySizedIntegral to arbitrary, due to overflow errors. Maybe there should be a warning somewhere about the silent overflow behavior.

And I added a Bounded instance for TimeSpec / Seconds, hopefully it's correct.