You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Time uses U32 to encode seconds and microseconds. Consider using I32 for these. There will arise the need to subtract times.
Rationale
Consider the case of subtracting 2^32 from 0 seconds. You need 33 bits for that.
A subtraction needs to return a time-difference type. If you use I32, Time can be used.
I32 is still big enough to add or subtract two values of nanoseconds, if you ever change to that.
Changing U32 to I32 is unlikely to break any existing code (that does not subtract time).
If you look in POSIX implementations for struct timespec you'll see that usually long and not unsigned long is used. I guess it is for the reasons above.
The text was updated successfully, but these errors were encountered:
Feature Description
Time uses U32 to encode seconds and microseconds. Consider using I32 for these. There will arise the need to subtract times.
Rationale
If you look in POSIX implementations for
struct timespec
you'll see that usuallylong
and notunsigned long
is used. I guess it is for the reasons above.The text was updated successfully, but these errors were encountered: