[ntp:questions] Converting from Y-m-d h:m:s

unruh unruh at wormhole.physics.ubc.ca
Sat May 15 03:25:58 UTC 2010


On 2010-05-14, Marc Leclerc <marc-leclerc at signaturealpha.com> wrote:
> Hi,
>
> is there any consideration when converting GPS/UTC DateTime YYYY MM DD 
> HH mm ss to a timespec value to set the system clock, I though I could 
> find a function to do this easily. Do the leap seconds in UTC have to be 
> considered when setting the system wall time

AFAIK leapseconds are our of sight as far as UTC is concerned. Ie the
UTC seconds since 1970 are 13 fewer than the actual number of seconds
that someone living from 1970 to now has experienced.
86400*((Y-1970)*365+#leapyears+dayofyear-1)+3600*h+60*m+s
is the number of UTC ( and ntp) seconds since 1970.

Note that ntp has a subroutine to do the conversion from seconds to/from
dates as does gettimeofday.

>
> Thanks




More information about the questions mailing list