Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monotonically increasing timestamps? #9

Open
axiak opened this issue Dec 19, 2014 · 2 comments
Open

Monotonically increasing timestamps? #9

axiak opened this issue Dec 19, 2014 · 2 comments

Comments

@axiak
Copy link

axiak commented Dec 19, 2014

The timestamp generation at https://github.com/aphyr/meangirls/blob/master/lib/meangirls.rb#L59 fails to be monotonic if the server is running NTP and performs a clock adjustment. Is there a better clock here?

@aphyr
Copy link
Owner

aphyr commented Dec 19, 2014

Yeah, we should use a disk-backed flake time.

@navinp1281
Copy link

return Process.clock_gettime(Process::CLOCK_MONOTONIC_RAW)
No intialization etc per system. It works as per the below definition.
I think there is a BSD CLOCK_MONOTONIC_PRECISE but this is from linux.

man clock_gettime
CLOCK_MONOTONIC_RAW (since Linux 2.6.28; Linux-specific)
Similar to CLOCK_MONOTONIC, but provides access to a raw hard‐
ware-based time that is not subject to NTP adjustments or the
incremental adjustments performed by adjtime(3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants