Annotate truncating of time values saved in a packet
Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential D21220
ping6: Annotate truncating of time values saved in a packet asomers on Aug 12 2019, 7:30 AM. Authored by Tags None Referenced Files
Subscribers None
Details
Annotate truncating of time values saved in a packet Submitted by: Ján Sučan <sucanjan@gmail.com>
Diff Detail
Event Timeline
Comment Actions A useful comment would tell the reader why it's ok to truncate the time in this case. Usually, that would be very bad. But in this case, we're only concerned about the difference between two close timespecs. Dropping the MSB from both samples won't affect their difference[1]. So a useful comment would say something like "Truncate seconds down to 32 bits in order to fit the timestamp within 8 bytes of the packet. We're only concerned with durations, not absolute times". [1] Actually, it could affect the difference once every 68 years or so. But your other commit, which replaces gettimeofday with clock_gettime, will mostly fix that. CLOCK_MONOTONIC is implemented by measuring seconds since boot. So then ping6 will only have a problem after 68 years of _uptime_. Comment Actions In fact, maybe you should combine this revision with the clock_gettime change. The combination is more correct than this change alone. |