UTC is a way of defining units of time so that at larger scales it matches TT, while at larger scales it matches UT.
UTC is a way of defining units of time so that at larger scales it matches TT, while at larger scales it matches UT.
I had a very productive conversation with Jacob Quinn and Mike Nolta this afternoon about how to deal with dates and times in Julia and I'm sharing some (still tentative) decisions we reached while it's all fresh in my mind both for my own records and so that others can comment on the design.
There will not be support for parsing or using political time zones in base Julia. When you call now() to get the current time, you will get a UT timestamps. Both UT and TT timestamps are completely divorced from location – they mean the same thing everywhere and don't imply anything about location.
On Wed, Feb 12, 2014 at 9:22 AM, Patrick O'Leary <patrick...@gmail.com> wrote:
Since it's fresh on *my* mind, will TimeZones have enough information to get GPS time, which is TT-based, with an epoch in 1980? This works out to UTC-(number of leap seconds since the first SV went online), or TAI-19s. It would be nice not to have to pull in all of GPSTK for that.I may not be understanding the question, but a TimeZone value would just be an indication of one of the political time zones (or an offset), so it wouldn't encode GPS time or anything like that.
I think Patrick means, given a timestamp encoded in some local time, say
Pacific Time, is there enough information in to translate it to GPS/TT
time. I would think so.
I have another concern (maybe this was raised in the discussion already
but I don't want to read it a third time): I create a time stamp in the
future, which would be a UTtimestamp by default in Julia. How to I get
the time difference in SI seconds to another timestamp? I think that is
not possible as we don't know deltaT in the future (nor in the distant
past really, but for that we could just define one). We could make a
deltaT up but then, as real time progresses, the real deltaT and the
made up one will diverge. Thus the time difference in SI seconds
between my two timestamps will change as real time progresses. So,
probably the only consistent thing would be to throw an error if one
tries to get a time difference (in SI seconds) with a UTtimestamp in the
future. This would probably throw people off.
Then, is there a standard deltaT, which everyone uses to covert UT<->TT?
This one: http://maia.usno.navy.mil/ ? If there isn't, then at least
Julia should be very clear what is used to convert and what
interpolation is used between datapoints.
I'm not sure to what extent it's possible to accurately predict ΔT, but I'm sure you realize that the core issue here is that in such a case translation between TT and UT is fundamentally impossible.
On Thu, 2014-02-13 at 16:09, quinn....@gmail.com wrote:> thread, the thing that *most* people think about *isn't* SISeconds, it's
> Mauro,
>
> I don't think throwing an error for converting a UTTimestamp in the future
> to TT will throw people off. As Stefan explained at the beginning of the
> UTAngleSeconds (or whatever we want to call them). What I mean is that if> between it and *another *UTTimestamp, which as Stefan explained is
> I'm dealing with a future UTTimestamp, 95% of the time I want the different
> completely straightforward and won't throw any errors (though you're notYes, I can see that that would be the case most of the time. But these days with GPS data galore, there are a lot of SI seconds around, or not?
> getting SIseconds back).
So, there is potential for the gotcha will be that adding seconds to a UTtimestamp in the past (or present, how present is present, June 2014?) works but if it is in the future it throws an error. We just need to make sure that doesn't happen often.
For conversion UT<->TT: what would Julia do if the astronomers figure out that they calculated deltaT slightly wrong and update their historical data table. Does that mean all SI-time differences in Julia change? Or do we keep using the old standard? The former could lead to some strange behaviour.
I'm still confused about how time zones enter into the picture.
On Thu, 2014-02-13 at 17:11, pyg...@gmail.com wrote:
>> I'm not sure to what extent it's possible to accurately predict ΔT, but
>> I'm sure you realize that the core issue here is that in such a case
>> translation between TT and UT is fundamentally impossible.
>>
>
> Especially since TT is officially established retrospectively, by pooling
> the output of atomic clocks from around the earth and from satellites.
> Meanwhile, it is approximated using the output of local clocks.
>
> But, with some margin of error, couldn't you match future UT and TT
> according to an astronomical model encompassing the rotation of the earth,
> the phase of the moon, the precession of the axis of rotation of the earth,
> and longitude/latitude (the precession means that the angular velocity of
> the surface relative to the sun is not the same everywhere), and other
> factors I can't think of?
>
> I suppose that UT is determined at Greenwich, and linearly extrapolated
> around the earth.
No, the problem is not TT and atomic clocks are not running at the same
speed (those differences are tiny). The problem is that the earth's
rotation is unsteady.
Just to be clear: we are talking here about using UT and assuming that the Earth's rotation is perfectly constant (degrees per hour) right? ie. UT seconds are just slightly different from SI seconds, which is something that leap-seconds seek to converge.
No, we're not assuming that at all. UT is defined in terms of the Earth's rotation.OK I see what you mean, you are right time will appear to warp (compared with SI) with large geological events..
I'm suspect that Terrestrial Time did not change.
I had a very productive conversation with Jacob Quinn and Mike Nolta this afternoon about how to deal with dates and times in Julia and I'm sharing some (still tentative) decisions we reached while it's all fresh in my mind both for my own records and so that others can comment on the design.===Times and dates in base Julia will use Universal Time (UT). UT seconds are defined to be the amount of time it takes the Earth to rotate 1/86400 of a turn. This is not a fixed duration – the UT second is not really a unit of time, but rather an angle. The advantage of UT is that it is simple and intuitive – by definition, there are no leap seconds and most importantly, you can use dates and times as far into the past and the future as you want. This is how people expect dates and times to work.
The disadvantage of UT is, of course, that its seconds are not fixed durations – i.e. "time" is not measured in SI seconds. The SI second is the fundamental unit of the other major time standard: Terrestrial Time (TT). This is the kind of time you want if you are doing physics and computing velocities and accelerations and such. If you just want to work with SI seconds, you can load the SIUnits package (or its heir). Converting between UT and TT will require loading another package which implements ΔT – i.e the difference between UT and TT as a function of time (think about that for a second). The reason to separate the conversion from SIUnits is that the data to compute ΔT is quite extensive, and it's entirely possible to work with SI times without needing to do any translation between TT and UT. It may be possible to approximate ΔT more compactly, in which case we could consider just including the translation infrastructure in SIUnits.
UTC is a way of defining units of time so that at larger scales it matches TT, while at larger scales it matches UT. The basic unit of time in UTC is the SI second just like TT, and every time unit from seconds down means the same thing that it does in TT and represents a fixed temporal duration. Above the scale of seconds is where the complications set in. Most UTC minutes are 60 seconds, but every now and then, the last minute of a day is 61 seconds – it contains an extra "leap second". All hours are 60 minutes, but if one of those minutes contains a leap second, the hour is 3601 seconds long instead of 3600 seconds, and similarly, each day has 24 hours, but if one of those hours contains a leap second, the day is 86401 seconds instead of the usual 86400. Given two UTC dates and times, if you know how many leap seconds occurred between them, you can easily compute how many SI seconds the intervening duration consisted of. Although many time systems claim to be using UTC, they are usually actually using UT (e.g. Joda-Time). Among other things, UTC is only defined after 1972 and a few months into the future. If these systems were really using UTC, they would be unable to work with dates and times outside of that range. These systems also typically don't have leap seconds. That is, in fact completely correct behavior for working with UT but it is not UTC.For system functions that return UNIX times, Julia will simply interpret their values as UT (with the appropriate linear offsets). This is incorrect behavior but *mandated* by POSIX, and it's what every system does. This means that differences between system times will be in terms of UT seconds – so they are technically angles, not durations, although we probably don't want to shove that in people's faces. In particular, you cannot convert a UT duration to SI seconds since that conversion depends on when the duration occurred. Instead, if you want a duration in SI seconds, you need to convert the start and end times to TT first and then subtract them, yielding a difference in SI seconds.There will not be support for parsing or using political time zones in base Julia. When you call now() to get the current time, you will get a UT timestamps. Both UT and TT timestamps are completely divorced from location – they mean the same thing everywhere and don't imply anything about location. However, we may want to determine the system's current offset from Zulu time (i.e. UTC+0 – the zero-offset timezone, as opposed to the UTC time standard) and print timestamps in local time with the appropriate offset. For example, if I'm in New York and ask for the time, I might see it printed as "2014-02-11 23:48:57 -0500" (this is what Ruby prints), even though the time object that's being printed doesn't include any time zone. Rather, the offset comes from a global configuration that is automatically set at startup time. We may want to honor the TZ environment variable for this. It may seem questionable that the same time value will print differently on different systems, but the key is that if you parse any of those output forms back into a timestamp value, you will get identical values. If you want to default to printing timestamps in Zulu time, you can just set an environment variable (or change the global setting in your .juliarc.jl file).
The TimeZones package will provide zoned date/time types that include both a timestamp and a time zone (this should probably support both offsets and political time zones). The timestamp field is still an absolute UT or TT value (both should be supported) and means the same thing, irrespective of the time zone field; the time zone field is included only to modify how the date and time should be displayed. If you were, for example, storing timestamps with time zones in a data frame, you could just as well store the timestamp and the time zone separately. The main reason for combining the two into a single value is so that the values can be conveniently displayed in the appropriate time zone. This can also allow convenient behaviors like producing another zoned value with the same time zone when adding a duration to a zoned date time.===Immense thanks to both Mike and Jacob for this enlightening discussion – especially to Mike for steering us expertly through this tricky subject. Mike, please correct me if I've made any errors here.
Dr Markus Kuhn (University of Cambridge) lists the following arguments against leap seconds:
- Leap seconds could cause disruptions where computers are tightly synchronized with UTC.
- Leap seconds are a rare anomaly, which is a concern for safety-critical real-time systems (e.g. air-traffic control concepts entirely based on satellite navigation).
His arguments in favor of leap seconds include:
- Astronomical time (UT1), which is defined by Earth's rotation, is not significant in most people’s daily lives.
- There have been no credible reports about serious problems caused by leap seconds.
- Some computerized systems that work with leap seconds are costly to modify (eg. antennas that track satellites).
- Computer errors caused by leap seconds can be avoided simply by using International Atomic Time (TAI) instead of Universal Coordinated Time (UTC).
- Desktop computers and network servers have no trouble coping with leap seconds.
- Humankind has defined time by the Earth's rotation for over 5000 years – this tradition should not be given up because of unfounded worries of some air-traffic control engineers.
- Abandoning leap seconds would make sundials obsolete.
The more proper question is, why don't any other languages/libraries/packages
advertise that the definition of the second is actually complicated? :-) Ours
is the same as everyone else's.
On Apr 22, 2015, at 10:00 AM, Jacob Quinn <quinn....@gmail.com> wrote:Scott,Great to hear some additional thoughts on this. For context on the current state of DateTime in Julia, see the following:I think Tim Holy's point is valid; a lot of programming languages don't even seem to acknowledge the existence of leap seconds or in several cases say things like, "Language X supports UTC time through its DateTime type. Leap seconds are not supported." which is a total contradiction.
So tl;dr, we decided to base the core DateTime type on UT time which has very natural calculation properties (Date + Day, DateTime + Second) and is extremely simple to reason about for the majority of use cases for a general programming language. Also check out https://github.com/Keno/SIUnits.jl which supports a SISecond type. There have been several discussions on supporting a full TAI/UTC DateTime type as well that would be based on this SISecond type (I even have some old code lying around that incorporated leap seconds….)
Why doesn't Julia use TAI-10, there is a nice library, it is available for most platforms I believe...
there is no notion of “leap seconds” here
Datetimes are always stored based on POSIX time (though having a TAI mode which allows for accounting of leap-seconds is proposed), with a epoch of 1970-01-01T00:00Z.
Although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine. Nearly all modern operating systems assume that 1 day = 24 × 60 × 60 = 86400 seconds in all cases.
Joda-Time does not support leap seconds.
Returns the number of non-leap seconds since whatever time the system considers to be the epoch
Python: http://joda-time.sourceforge.net/faq.html#leapsecondsthere is no notion of “leap seconds” here