[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200508201859.vlffp4fomw2fr4qc@pali>
Date: Fri, 8 May 2020 22:18:59 +0200
From: Pali Rohár <pali@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org
Subject: Missing CLOCK_BOOTTIME_RAW?
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?
Powered by blists - more mailing lists