lkml.org 
[lkml]   [2008]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: nanosleep() uses CLOCK_MONOTONIC, should be CLOCK_REALTIME?
On Sun, Jun 22, 2008 at 9:35 AM, Michael Kerrisk <mtk.manpages@gmail.com> wrote:
> Thomas,
>
> (I gues you are the right target for this?)
>
> The POSIX.1 specification of nanosleep() says:
>
> But, except for the case of being interrupted by a signal, the
> suspension time shall not be less than the time specified by
> rqtp, as measured by the system clock CLOCK_REALTIME.
>
>
> However, reading kernel/hrtimer.c:sys_nanosleep(), it appears that
> CLOCK_MONOTONIC is used.
>
> return hrtimer_nanosleep(&tu, rmtp, HRTIMER_MODE_REL, CLOCK_MONOTONIC);
>
> Is there a reason to use CLOCK_MONOTONIC, instead of CLOCK_REALTIME? Is it
> intentional? If yes, then I should document this in the man-pages. If not,
> then it should be fixed.

CLOCK_MONOTONIC works fine even if ntpd steps the clock forward or
backward, CLOCK_REALTIME not. So the man page should be fixed.

Strange to find such phrases in the POSIX specs ...

Bart.


\
 
 \ /
  Last update: 2008-06-23 10:37    [W:0.062 / U:1.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site