countly-sdk-cpp icon indicating copy to clipboard operation
countly-sdk-cpp copied to clipboard

Calculating durations should use a monotonic clock instead of system_clock

Open jwheeler91 opened this issue 3 years ago • 0 comments
trafficstars

Durations should not use the system_clock as this can change, resulting in "incorrect" durations (e.g. a user changing the system clock back an hour while an application is running in the background could result in a negative duration).

Instead, durations should be calculated using a monotonic clock (e.g. steady_clock)

However: timestamps need to continue to use system_clock as they need a known epoch time (steady_clock won't provide a known epoch - it ends up as time since the clock started)

jwheeler91 avatar Nov 08 '22 11:11 jwheeler91