diff options
| author | Andrew Morton <akpm@digeo.com> | 2003-04-20 00:26:21 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-04-20 00:26:21 -0700 |
| commit | 2f98681fa42f8971f09ca96ce6329fa3a3ff0740 (patch) | |
| tree | 36573c53d2fc11ba370d3c9aeb499180d2c1b65e /include/linux | |
| parent | 0e3efbd1ebf9b6f6b16cd5b68465f02dbe72dff0 (diff) | |
[PATCH] Fix POSIX timers to give CLOCK_MONOTONIC full
The POSIX CLOCK_MONOTONIC currently has only 1/HZ resolution. Further, it is
tied to jiffies (i.e. is a restatment of jiffies) rather than "xtime" or the
gettimeofday() clock.
This patch changes CLOCK_MONOTONIC to be a restatment of gettimeofday() plus
an offset to remove any clock setting activity from CLOCK_MONOTONIC. An
offset is kept that represents the difference between CLOCK_MONOTONIC and
gettimeofday(). This offset is updated when ever the gettimeofday() clock is
set to back the clock setting change out of CLOCK_MONOTONIC (which by the
standard, can not be set).
With this change CLOCK_REALTIME (a direct restatement of gettimeofday()),
CLOCK_MONOTONIC and gettimeofday() will all tick at the same time and with
the same rate. And all will be affected by NTP adjustments (save those which
actually set the time).
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/time.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index 4d7238025fe9..6fad88e1a37d 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -140,6 +140,7 @@ mktime (unsigned int year, unsigned int mon, } extern struct timespec xtime; +extern struct timespec wall_to_monotonic; extern seqlock_t xtime_lock; static inline unsigned long get_seconds(void) @@ -200,6 +201,9 @@ struct itimerval { #define CLOCK_MONOTONIC_HR 5 #define MAX_CLOCKS 6 +#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC | \ + CLOCK_REALTIME_HR | CLOCK_MONOTONIC_HR) +#define CLOCKS_MONO (CLOCK_MONOTONIC & CLOCK_MONOTONIC_HR) /* * The various flags for setting POSIX.1b interval timers. |
