Message ID | 1435810066-106004-1-git-send-email-shawn@churchofgit.com |
---|---|
State | New |
Headers | show |
Shawn Landden wrote: > Introduce CLOCK_EARTH, that for now is CLOCK_REALTIME, but may in the future become > UT1 (mean solar time at zero degrees longitute) No, let's not try to guess what the ITU-R will do, or how POSIX will or won't accommodate this. Let's wait first for ITU-R to act at the WRC-15 in November. Possibly they'll do nothing. Even if they do something, they'll give at least five years' notice before the change takes effect, and we'll likely see leap seconds during that period anyway. There is certainly no rush to alter glibc about this topic now. My source: Expert advice: a leap second — one more time! GPS World 2015-04-30 <http://gpsworld.com/expert-advice-a-leap-second-one-more-time/>
On 02/07/15 05:07, Shawn Landden wrote: > If leap seconds are abolished for leap hours, as has been repeately proposed, and > clocks remain in UTC, then the fact that the day is slightly shorter than 86400 > seconds will slowly accumulate. Over time this will make UTC undesirable for > astronomical applications, such as sun-rise, sun-set, and solar noon. the day is not shorter but longer (usually). > diff --git a/timezone/leapseconds b/timezone/leapseconds > index d6343c0..717a792 100644 > --- a/timezone/leapseconds > +++ b/timezone/leapseconds > @@ -48,6 +48,8 @@ Leap 1997 Jun 30 23:59:60 + S > Leap 1998 Dec 31 23:59:60 + S > Leap 2005 Dec 31 23:59:60 + S > Leap 2008 Dec 31 23:59:60 + S > +Leap 2012 Jun 30 23:59:60 + S > +Leap 2015 Jun 30 23:59:60 + S > > # INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS) > # this is independent of CLOCK_EARTH. i think timezone/ should be updated according to upstream tz data.
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c index 2975368..ddc4058 100644 --- a/sysdeps/unix/clock_gettime.c +++ b/sysdeps/unix/clock_gettime.c @@ -93,6 +93,12 @@ __clock_gettime (clockid_t clock_id, struct timespec *tp) { int retval = -1; + /* UTC is currently tied to Earth time through use of leap seconds. If this + changes in the future we can provide an implementation of UT1 in a forward + compatible way. */ + if (clock_id == CLOCK_EARTH) + clock_id = CLOCK_REALTIME; + switch (clock_id) { #ifdef SYSDEP_GETTIME diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h index 706946c..4b1094d 100644 --- a/sysdeps/unix/sysv/linux/bits/time.h +++ b/sysdeps/unix/sysv/linux/bits/time.h @@ -77,9 +77,13 @@ extern long int __sysconf (int); # define CLOCK_REALTIME_ALARM 8 /* Like CLOCK_BOOTTIME but also wakes suspended system. */ # define CLOCK_BOOTTIME_ALARM 9 -/* Like CLOCK_REALTIME but in International Atomic Time. */ +/* Like CLOCK_REALTIME but in International Atomic Time. + * GPS + 19 = TAI + * Loran-C + 28 = TAI + */ # define CLOCK_TAI 11 - +/* Like CLOCK_REALTIME but always mean solar time of zero degrees long (maybe UT1). */ +# define CLOCK_EARTH 12 /* Flag to indicate time is absolute. */ # define TIMER_ABSTIME 1 # endif diff --git a/timezone/leapseconds b/timezone/leapseconds index d6343c0..717a792 100644 --- a/timezone/leapseconds +++ b/timezone/leapseconds @@ -48,6 +48,8 @@ Leap 1997 Jun 30 23:59:60 + S Leap 1998 Dec 31 23:59:60 + S Leap 2005 Dec 31 23:59:60 + S Leap 2008 Dec 31 23:59:60 + S +Leap 2012 Jun 30 23:59:60 + S +Leap 2015 Jun 30 23:59:60 + S # INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS) #