lkml.org 
[lkml]   [2020]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Missing CLOCK_BOOTTIME_RAW?
Date
Pali Rohár <pali@kernel.org> writes:
> On Monday 18 May 2020 14:13:48 Thomas Gleixner wrote:
>> Of course not, but the kernel relies on that application behaving
>> sanely. If it does not then the time stamps you are complaining about
>> are the least of your worries.
>
> I do not thing it is too bad... When I needed to deal in userspace with
> time/date/clock I just needed either "current time in UTC" to show it to
> user (possible in different timezone and pretty formatted) or I needed
> "timestamp since some epoch" suitable for measuring time differences.
>
> For first case I used CLOCK_REALTIME and for second case I used
> CLOCK_MONOTONIC_RAW (as it was not affected by adjtime()).
>
> And I would like to know, it is correct to use these two clocks in those
> situations?

It's your choice to do so. I prefer CLOCK_MONOTONIC simply because it's
in human understandable units and not some assumed frequency.

> Anyway, what would happen with CLOCK_BOOTTIME when during suspend is
> that external RTC source shifted back? Is kernel guarantee that
> CLOCK_BOOTTIME is always monotonic even in this case?

If the RTC delta is negative, then it's ignored, i.e. 0 sleep time
injected.

Thanks,

tglx

\
 
 \ /
  Last update: 2020-05-18 15:01    [W:0.091 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site