ObjFW  View Ticket

Ticket UUID: 15bcaa7d13c70fa5648ac97d9063dbcb127c7625
Title: Add helper functions for time intervals
Status: Closed Type: Enhancement
Severity: Important Priority: High
Subsystem: Resolution: Rejected
Last Modified: 2021-08-07 16:45:06
Version Found In: Milestone: 1.0
User Comments:
js added on 2021-04-17 00:47:27:

Time intervals are currently doubles with no further abstraction. This means that time intervals are added, subtracted and compared using regular double operations. This is problematic on platforms on which double is slow or even non-existent. It would be better to make it transparent and offer helper functions: This would allow to make it struct with two integers in the future.


js added on 2021-08-07 16:45:06:

This is probably not worth it, as pretty much all compilers allow to generate code that uses doubles just via integer arithmetics. Yes, this is slow, but nothing should use so many time intervals that this is actually a problem. Using a struct that is just a double on some platforms and two integers on others would result in different precision on different systems - something that is very much not desirable. It would also make it much harder to serialize time intervals or dates.