
"Simon Marlow"
On 03 February 2005 13:01, Ashley Yakeley wrote:
But I agree with the rest of what you say. Basically, providing TAI time is problematic because we can't implement it correctly, for future times, on systems that only provide POSIX time.
At this point I'm not sure what is best, I'm still quite disturbed by the idea of basing the definition of the Haskell Time library on what is basically a mistake in the definition of POSIX :-)
Somehow I fail to see the problem... Basically we need two different representations of time anyway, a calendar and something like TAI. The calendar is necessary for everyday operations, like rolling the date field. This can't be done by adding seconds to any counter: adding 86400 seconds to get to the next day fails at least twice a year when switching from/to DST. The "number of seconds" is necessary for timestamping. The way I see it, both worlds almost never intersect, the only contact points are formatting time stamps and converting the current system time to calendar time. Suppose we settle for TAI and a separate calendar. We also assume, the system clock provides TAI, maybe allow an offset to be configured. If the system time is TAI indeed, all is well. Conversion to calendar time will always work, because we only convert dates in the past, where leap seconds are known. Assume the system provides UTC or POSIX time or something like that. Then our time stamps will still work, as they are still monotonically increasing. Nothing fails, only the conversion to calendar time will be off by around 20 seconds. So what? If the modification time of a file is off by some seconds, probably no one will notice. Same for the current time, most often. If these few seconds matter, the offset could still be "configured away", and who cares if it isn't reliable or exact, the system time was broken to begin with. Therefore, TAI + calendar + (optional) a fixed offset. What am I missing? Regards, Udo. ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193

"Udo Stenzel"
The way I see it, both worlds almost never intersect, the only contact points are formatting time stamps and converting the current system time to calendar time.
These "only" points are the problem.
Assume the system provides UTC or POSIX time or something like that. Then our time stamps will still work, as they are still monotonically increasing. Nothing fails, only the conversion to calendar time will be off by around 20 seconds. So what?
If Haskell programs interpreted the current time and timestamps differently than all other parts of the system, shifted by 20 seconds, this is unacceptable.
If these few seconds matter, the offset could still be "configured away", and who cares if it isn't reliable or exact, the system time was broken to begin with.
It was not broken. Yes, it would be better if the system clock ran in TAI, and there was an automatically updated system-wide leap second table kept current, and it was supported by the C library and by NTP clients. But it is not the case.
Therefore, TAI + calendar + (optional) a fixed offset.
What am I missing?
That you don't know the correct offset. If a program begins miscalculating the time when it's run 6 months after the Haskell compiler it was compiled with was been updated, and thus programs compiled using different versions of the compiler interpret the same timestamp differently, this makes no sense. The problem with supporting TAI is that its relation to UTC is not known far in advance, and it is UTC which is shown to users and distributed by NTP and manipulated by all other programs. TAI runs smoothly but it's unimplementable. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/

On Thursday 03 February 2005 18:42, Marcin 'Qrczak' Kowalczyk wrote:
"Udo Stenzel"
writes: Therefore, TAI + calendar + (optional) a fixed offset.
What am I missing?
That you don't know the correct offset.
If a program begins miscalculating the time when it's run 6 months after the Haskell compiler it was compiled with was been updated, and thus programs compiled using different versions of the compiler interpret the same timestamp differently, this makes no sense.
No problem if the leap second table used is a parameter of the conversion. Ben -- "The CIA is Wallstreet. Wallstreet is the CIA." (Mike Ruppert)

Benjamin Franksen
Therefore, TAI + calendar + (optional) a fixed offset.
What am I missing?
That you don't know the correct offset.
If a program begins miscalculating the time when it's run 6 months after the Haskell compiler it was compiled with was been updated, and thus programs compiled using different versions of the compiler interpret the same timestamp differently, this makes no sense.
No problem if the leap second table used is a parameter of the conversion.
You shift the responsibility without eliminating the problem. The program begins miscalculating the time when it's run 6 months after its author has updated the leap second table which the program uses. Of course it's impossible to solve it. This means that conversion between TAI and UTC should be avoided when possible. If the user wants to obtain UTC, doesn't mind a hiccup on leap seconds, and doesn't want to keep a leap second table up to date and arrange for a long-running program to reread it when it changes - he can set the system clock to UTC and the program should then interpret the system clock as UTC. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/

Marcin 'Qrczak' Kowalczyk wrote:
You shift the responsibility without eliminating the problem. The program begins miscalculating the time when it's run 6 months after its author has updated the leap second table which the program uses.
Of course it's impossible to solve it. This means that conversion between TAI and UTC should be avoided when possible.
If the user wants to obtain UTC, doesn't mind a hiccup on leap seconds, and doesn't want to keep a leap second table up to date and arrange for a long-running program to reread it when it changes - he can set the system clock to UTC and the program should then interpret the system clock as UTC.
Why doesnt the library connect to one of the TAI clocks, and read the leap second table. If the system clock is UTC the system must be running NTP and be connected to a network. If it is not running NTP the system time is more or less TAI anyway (no leap seconds occur without a networked time reference and NTP) I would suggest having the library read the leap seconds table as part of the library, as leap seconds can only occur at the end of june or december, you have 6th months to update the table. Keean.

In article <420354F4.6030201@imperial.ac.uk>,
Keean Schupke
Why doesnt the library connect to one of the TAI clocks, and read the leap second table.
This means having to make network connections just to tell the time. Is this a good idea?
If the system clock is UTC the system must be running NTP and be connected to a network. If it is not running NTP the system time is more or less TAI anyway (no leap seconds occur without a networked time reference and NTP)
I think even people who don't use NTP set their clock to UTC at the time they set it. You can call that TAI with a fixed offset if you want (and an offset we can't discover), but the difference is probably less significant than the clock drift, and in the long term they'll likely eventually set it to UTC again. -- Ashley Yakeley, Seattle WA

Ashley Yakeley wrote:
I think even people who don't use NTP set their clock to UTC at the time they set it. You can call that TAI with a fixed offset if you want (and an offset we can't discover), but the difference is probably less significant than the clock drift, and in the long term they'll likely eventually set it to UTC again.
SO in effect what you are saying is that system time is likely to be neither TAI nor UTC (as hand setting a clock has a greater than 1 second error usually, a non-networked machine will never tell the right time (and even a stopped clock tells the right time twice a day!). If the machine is not networked then its time cannot be compared to other time sources, so absolute time is meaningless... as such we are left with relative time (which is TAI like as it counts seconds from switch on). If I am timing an interval measured in seconds, I do not want the user changing the 'calendar time' to affect my accurate timings. I am pretty sure the "clock()" function returns a millisecond count, which added to the hardware time at switch on (as the user cannot adjust time when the machine is switched off - nor can NTP adjust this) gives TAI (possibly with a different start time). Keean.

In article <42035F4E.6000104@imperial.ac.uk>,
Keean Schupke
SO in effect what you are saying is that system time is likely to be neither TAI nor UTC (as hand setting a clock has a greater than 1 second error usually, a non-networked machine will never tell the right time (and even a stopped clock tells the right time twice a day!).
Can we make that assumption? There might be ways of keeping the clock accurate that don't involve TCP/IP.
I am pretty sure the "clock()" function returns a millisecond count, which added to the hardware time at switch on (as the user cannot adjust time when the machine is switched off - nor can NTP adjust this) gives TAI (possibly with a different start time).
The clock() function drifts and as you say cannot be adjusted, so it cannot be considered TAI. It is however a good choice for timing intervals, as it doesn't hiccup. -- Ashley Yakeley, Seattle WA

On 2005-02-04, Ashley Yakeley
In article <42035F4E.6000104@imperial.ac.uk>, Keean Schupke
wrote: SO in effect what you are saying is that system time is likely to be neither TAI nor UTC (as hand setting a clock has a greater than 1 second error usually, a non-networked machine will never tell the right time (and even a stopped clock tells the right time twice a day!).
Can we make that assumption? There might be ways of keeping the clock accurate that don't involve TCP/IP.
Right. The NTP source code has plenty of other things that can by synced off of, including many fairly common GPS receivers, and radio clocks. -- Aaron Denney -><-

Aaron Denney wrote:
Right. The NTP source code has plenty of other things that can by synced off of, including many fairly common GPS receivers, and radio clocks.
Does this mean I can sync my system time to TAI using a GPS reciever? Sounds like how it should be done... Keean.

On Sat, Feb 05, 2005 at 09:33:20AM +0000, Keean Schupke wrote:
Aaron Denney wrote:
Right. The NTP source code has plenty of other things that can by synced off of, including many fairly common GPS receivers, and radio clocks.
Does this mean I can sync my system time to TAI using a GPS reciever? Sounds like how it should be done...
Yes. look at the various "refclock"s in the distribution. Note that as mentioned a few times on this list, getting everything to agree on the interpretation may be difficult, though using the set of timezones labeled "right" will go far. -- Aaron Denney -><-

On Feb 5, 2005, at 4:33 AM, Keean Schupke wrote:
Aaron Denney wrote:
Right. The NTP source code has plenty of other things that can by synced off of, including many fairly common GPS receivers, and radio clocks.
Does this mean I can sync my system time to TAI using a GPS reciever? Sounds like how it should be done...
Many, but not all, GPS clocks can deliver GPS time (i.e., the time based on the number of seconds since the GPS epoch 1980 January 6 00:00 UTC converted to a calendar time using days of 86400 seconds and the standard leap year rule). TAI is ahead of GPS time by 19 seconds, and as GPS time does not have leap seconds, TAI = GPS + 19 s. Raw GPS time (the number of seconds since the GPS epoch) is broadcast in a complicated form in the satellites' navigation message, along with the current number of UTC leap seconds since the GPS epoch. From the raw GPS time and the number of leap seconds UTC can be calculated. The gory details of the GPS navigation messages are available in the signal specification document, http://www.navcen.uscg.gov/pubs/gps/sigspec/gpssps1.pdf The GPS clock in my office, an old TrueTime XL-AK, can be set to output GPS time instead of UTC. (Unfortunately, it can't be forced to output the number of leap seconds directly, you have to calculate leap seconds from the difference between GPS and UTC times.) I have worked with other clocks, in particular an Odetics SatSync unit that would only provide UTC. That clock would not provide low level access to the fields of the navigation message, so we just had to maintain a table of leap seconds manually. Best Wishes, Greg
Keean. _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

In article <83fcd29a8070c7a77db3b2f01bbaac71@comcast.net>,
Gregory Wright
Raw GPS time (the number of seconds since the GPS epoch) is broadcast in a complicated form in the satellites' navigation message, along with the current number of UTC leap seconds since the GPS epoch. From the raw GPS time and the number of leap seconds UTC can be calculated.
So there's some way that the satellites get told about leap seconds when they're announced? -- Ashley Yakeley, Seattle WA

On Feb 6, 2005, at 7:18 PM, Ashley Yakeley wrote:
In article <83fcd29a8070c7a77db3b2f01bbaac71@comcast.net>, Gregory Wright
wrote: Raw GPS time (the number of seconds since the GPS epoch) is broadcast in a complicated form in the satellites' navigation message, along with the current number of UTC leap seconds since the GPS epoch. From the raw GPS time and the number of leap seconds UTC can be calculated.
So there's some way that the satellites get told about leap seconds when they're announced?
Yes, the GPS satellites have the next scheduled leap second insertion uploaded. They begin broadcasting the new leap second count when the scheduled leap second occurs. The navigation messages of the GPS satellites are frequently updated with the latest orbital parameters of the satellites, among other things. This is necessary because the gravitational perturbations of the moon and sun, and the higher multipole moments of the Earth's gravitational field slowly alter the orbits. Greg
-- Ashley Yakeley, Seattle WA
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

Keean Schupke
If the machine is not networked then its time cannot be compared to other time sources, so absolute time is meaningless...
It's still meaningful that filesystem timestamps are interpreted by Haskell programs in the same way as by other programs. Even if the current time as measured by the system might be disconnected from the reality and off by a few seconds, it's internally consistent across programs. Without network connection we know the intended UTC of timestamps, i.e. how the second counter should be converted to calendar time for display, even if this actually happened some time after or before the given time. We don't know TAI because we don't necessarily have an up to date leap second table. If there is a way to support TAI without disrupting the interpretation of the time on systems which use UTC everywhere, then it's fine by me.
I am pretty sure the "clock()" function returns a millisecond count, which added to the hardware time at switch on
No, it measures CPU time of the current process with an unspecified point of reference (usually the first clock() call). If the process is waiting for I/O, its clock doesn't tick. On systems with 32-bit clock_t it rolls over after 72 minutes. POSIX says that CLOCKS_PER_SEC should be 1000000, no matter what the actual clock accuracy is. clock() is useful for comparing performance of algorithms, even if there are other processes competing for the CPU. It doesn't completely eliminate their influence on the measurement though - if many other processes are running, less data fits in processor cache. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/
participants (7)
-
Aaron Denney
-
Ashley Yakeley
-
Benjamin Franksen
-
Gregory Wright
-
Keean Schupke
-
Marcin 'Qrczak' Kowalczyk
-
Udo Stenzel