All of lore.kernel.org
 help / color / mirror / Atom feed
* Missing CLOCK_BOOTTIME_RAW?
@ 2020-05-08 20:18 Pali Rohár
  2020-05-08 20:59 ` Thomas Gleixner
  0 siblings, 1 reply; 10+ messages in thread
From: Pali Rohár @ 2020-05-08 20:18 UTC (permalink / raw)
  To: Thomas Gleixner, linux-kernel

Hello Thomas!

I'm looking at clocks which are provided by kernel for userspace
applications via clock_gettime() syscall and I think that there is
missing clock variant CLOCK_BOOTTIME_RAW.

If userspace application wants to measure time difference between two
events then I think all of available clocks CLOCK_REALTIME,
CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW and CLOCK_BOOTTIME have some issues
for such task.

CLOCK_REALTIME may be changed but userspace and therefore time
difference between two events may be also negative.

CLOCK_MONOTONIC does not have to precise as there may be incremental
jumps caused by NTP or measured time difference may be smaller as
elapsed when system is suspended. During system suspend is clock
CLOCK_MONOTONIC stopped.

CLOCK_MONOTONIC_RAW is not affected by NTP jumps but still is not
suitable for measuring time differences when system is suspended.

CLOCK_BOOTTIME is affected by NTP jumps but provides correct time
difference when system was suspended during measurement.

So for me it looks like that there is missing CLOCK_BOOTTIME_RAW clock
which would not be affected by NTP jumps (like CLOCK_MONOTONIC_RAW) and
also would not be affected by system suspend (like CLOCK_BOOTTIME).

Please correct me if I'm wrong in some of my above assumptions. It is
how I understood documentation for clock_gettime() function from Linux
manpage.

Is there any reason why kernel does not provide such CLOCK_BOOTTIME_RAW
clock for userspace applications which would be interested in measuring
time difference which occurred between two events?

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-05-18 13:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 20:18 Missing CLOCK_BOOTTIME_RAW? Pali Rohár
2020-05-08 20:59 ` Thomas Gleixner
2020-05-08 21:31   ` Pali Rohár
2020-05-09  9:49     ` Thomas Gleixner
2020-05-18 11:11       ` Pali Rohár
2020-05-18 11:26         ` Thomas Gleixner
2020-05-18 11:35           ` Pali Rohár
2020-05-18 12:13             ` Thomas Gleixner
2020-05-18 12:49               ` Pali Rohár
2020-05-18 13:01                 ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.