browsermt / mts

Marian Translation Service
Apache License 2.0
18 stars 4 forks source link

gettimeofday isn't monotonic #14

Closed kpu closed 3 years ago

kpu commented 3 years ago

https://github.com/browsermt/mts/blob/41978b4c225138432883a8c1abc98e7a86a31c2c/src/bergamot/request.cpp#L23

NOTES
       The time returned by gettimeofday() is affected by discontinuous jumps in the system time (e.g., if the system
       administrator manually changes the system time).  If you need a monotonically increasing clock, see clock_get‐
       time(2).

Also do you even need a notion of clock time or is a sequence number sufficient to compare ages?

jerinphilip commented 3 years ago

Sequence number should be enough. Should we account for the case of overflow?

kpu commented 3 years ago

64 bits should be enough for everyone!