lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 28 Aug 2006 15:36:49 -0700
From:	john stultz <johnstul@...ibm.com>
To:	Roman Zippel <zippel@...ux-m68k.org>
Cc:	linux@...izon.com, linux-kernel@...r.kernel.org, theotso@...ibm.com
Subject: Re: Linux time code

On Mon, 2006-08-28 at 13:39 +0200, Roman Zippel wrote:
> On Thu, 23 Aug 2006, linux@...izon.com wrote:
> > > Additionally creating UTS and UTC at the same time would be a bit
> > > complicated. Your solution above isn't quite UTS, since it only handles
> > > the leap insertion, however the insertion case is the one that causes
> > > users most of the pain (since the clock goes backward), so it may very
> > > well be good enough.
> > 
> > It's not that it's hard to implement leap deletion, but it's code
> > on a moderately hot path (gettimeofday() is a very popular system
> > call) that will, as far as anyone knows, never be used.
> > 
> > If you want the full version, try:
> > 
> > 	case CLOCK_UTS:
> > 		/* Recommended for gettimeofday() & time() */
> > 		/* See http://www.cl.cam.ac.uk/~mgk25/uts.txt */
> > 		clock_gettime(CLOCK_TAI, tp);
> > 		tp->tv_sec -= tai_minus_utc;
> > 
> > 		if (tp->tv_sec > next_leap_second) {
> > 			tp->tv_sec += (next_leap_second & 1) ? -1 : 1;
> > 
> > 		} else if (next_leap_second - tp->tv_sec < 1000) {
> > 			/* 1000 UTC/TAI seconds = 999 or 1001 UTS seconds */
> > 			uint32_t offset = next_leap_second - tp->tv_sec + 1;
> > 			offset *= MILLION;
> > 			offset += (uint32_t)(BILLION - tp->tv_nsec)/1000;
> > 			if (next_leap_second & 1) {
> > 				/* Negative (deleted) leap second */
> > 				if ((tp->tv_nsec += offset) >= BILLION) {
> > 					tp->tv_nsec -= BILLION;
> > 					tp->tv_sec++;
> > 				}
> > 			} else {
> > 				/* Positive (inserted) leap second */
> > 				if ((tp->tv_nsec -= offset) < 0) {
> > 					tp->tv_nsec += BILLION;
> > 					tp->tv_sec--;
> > 				}
> > 			}
> > 		}
> > 		break;
> 
> Doing something like for this for gettimeofday() is pretty much obsolete 
> with the new time code. OTOH it's rather simple to smooth out the leap 
> second now, you can set time_adjust and adjust MAX_TICKADJ and the clock 
> will follow nicely.

While its possible to smooth out the leapsecond (which would be useful
to many folks), the problem is one's system would then diverge from UTC
for that leapsecond. 

The idea he's proposing here is to keep both UTC and UTS as separate
clock ids, allowing apps to choose which standard (well, I UTS isn't
quite a standard) they want to follow.

I think this would be quite useful, as I've seen a number of requests
where users don't want the leapsecond inconsistency, and others where
they need to strictly follow UTC.

I think having TAI would be nice too, but that requires quite a bit of
infrastructure work (NTP distributing absolute leapsecond counts, etc).

thanks
-john

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ