4 ms·
Why don't we let GPS satellites and NTP broadcast both "regular time" and International Atomic Time (TAI), and let each user use the one that fits best? So: sa
by Gring 15y ago
Why don't we let GPS satellites and NTP broadcast both "regular time" and International Atomic Time (TAI), and let each user use the one that fits best?
So: satellite navigation, financial services and flight control systems use TAI, everybody else uses regular time?
To make the difference obvious and prevent misunderstandings, TAI could even have a different form, like a pure integer of "seconds after date X". So nobody except programmers for financial services and other specialized systems would ever get to see TAI, and everybody's happy?
- qntm 15y agoIt seems[1] that GPS at least already broadcasts "GPS time", which is fixed at TAI plus 19 seconds, and hence doesn't include leap seconds. [1] http://en.wikipedia.org/wiki/Global_Positioning_System#Timekeeping_and_leap_seconds http://en.wikipedia.org/wiki/Global_Positioning_System#Timek...
- mseebach 15y agoI think you're on the right track, but I'd take it a step further: Whenever you're displaying what the time is to a human being, convert to UTC. In all other cases - especially storage and transmission etc. - use TAI. We have very rich libraries for dealing with time in software, so it's not like it would be a huge drag. There are still some unaddressed edge cases, of course. Say there's a leap second on 1 July. Now consider the interval 14:00 30 June - 14:00 1 July. In "human time" it's 24 hours, but in computer time it's 24h00m01s - and, conversely and perhaps more dangerous, should "14:00 30 June" + 24 hours come out as 13:59:59 or 14:00:00?
- masklinn 15y ago> We have very rich libraries for dealing with time in software 99.9% of which suck goats though. And then, there's the problem of correctly syncing time display with internal representation: let's say the library stores time as a monotonically increasing number (which it should, ideally, that's the first failure of many libraries). This monotonically increasing number is then mapped onto "human" dates and times via more or less complex schemes. The problem is that those mapping change over time, for instance the leap second is provided with 6 months of advance, DST/GST changes may be provided with far less (to say nothing of timezone changes). So those time libraries need to be updated all the bloody time or to have a mechanism through which they download mapping updates. > conversely and perhaps more dangerous, should "14:00 30 June" + 24 hours come out as 13:59:59 or 14:00:00? Well this is a human time mapping, in human time mappings the leap second is part of one of those 24h, so it'd be 14:00:00 (same as adding "1 day" or "1440 minutes"), whereas adding 86400 seconds would yield 13:59:59. The internal storage should not have a concept of hours (or minutes, or even maybe seconds), it would have its "time unit" and then contextual mappings from the time unit to "human units" through calendars and calendar operations.
- mseebach 15y ago> 99.9% of which suck goats though. The past decade has seen immense improvements, though. JodaTime is pretty neat and JSR-310 seems to be an improvement on that (haven't used it though). > And then, there's the problem of correctly syncing time display with internal representation [..] leap second is provided with 6 months of advance, DST/GST changes may be provided with far less (to say nothing of timezone changes). Since the time zone issue is the larger one anyway, this provides a solid (copyright trolling aside) framework for distributing this information: a database distributed and maintained as part of the OS. > Well this is a human time mapping [..] contextual mappings I agree, but it's the context that's hard. You need some way for your abstraction to capture the fact that a "minute" can sometime consist of 61 seconds. Consider an application that monitors the number of foos per minute where the developer perfectly reasonable uses the "minute" abstraction. This might then exhibit faulty behaviour when there's a leap second inserted - suddenly there's 1/60th more foos reported in a minute. Depending on the application, that might be statistically insignificant and can safely be ignored, or it might be a red flag that triggers someones pager to go off (or worse).
- masklinn 15y ago> The past decade has seen immense improvements, though. JodaTime is pretty neat and JSR-310 seems to be an improvement on that (haven't used it though). Joda is pretty much the 0.1% in question. On its own. > I agree, but it's the context that's hard. You need some way for your abstraction to capture the fact that a "minute" can sometime consist of 61 seconds. Absolutely. > Consider an application that monitors the number of foos per minute where the developer perfectly reasonable uses the "minute" abstraction. This might then exhibit faulty behaviour when there's a leap second inserted - suddenly there's 1/60th more foos reported in a minute. Ideally, this application should monitor the number of foos per [[time unit]], and only convert from [[time unit]] to minutes when it displays information. Of course you'd still have contextual issues: > Depending on the application, that might be statistically insignificant and can safely be ignored, or it might be a red flag that triggers someones pager to go off (or worse). Yeah. Unless those triggers use the rate per [[time unit]] instead of using the rate per "human" unit (would blow up on summer time end as well, as it "replays" a full human hour)