System.Time.Clock Design Issues

Ben Rudiak-Gould Benjamin.Rudiak-Gould at
Thu Feb 3 05:24:16 EST 2005

Ashley Yakeley wrote:

 >In article <4201AEFA.6070400 at>,
 > Ben Rudiak-Gould <Benjamin.Rudiak-Gould at> wrote:
 >>    * time_t is TAI (atomic seconds since TAI epoch) and gmtime returns
 >>UTC (with leap seconds)
 >>    * time_t is UTC (atomic seconds since UTC epoch) and gmtime returns
 >>UTC (with leap seconds)
 >I don't understand. What actual number does gmtime return in each case?

In the second case it returns 1972-07-14 22:13:19, because there's a 
86401-second day between then and 1970-01-01 00:00:00 UTC.

In the first case I suppose it would return :09, because 1970-01-01 
00:00:00 TAI is 10 seconds earlier than 1970-01-01 00:00:00 UTC, and to 
compensate gmtime would subtract 10 from the value passed in. Like I 
said I don't know if there are any systems like this. In fact I'm sure 
there aren't, now that I noticed that the libtai documentation says 
"This implementation of tai_now assumes that the time_t returned from 
the time function represents the number of TAI seconds since 1970-01-01 
00:00:10 TAI." That :10 at the end is what I hadn't noticed.

-- Ben

More information about the Libraries mailing list