[ntp:questions] POSIX Timestamp to NTP Timestamp

Kiss Gábor kissg at ssg.ki.iif.hu
Wed Sep 29 06:33:36 UTC 2010


> I am having some trouble converting a POSIX UTC timestamp into a NTP timestamp.
> The former being from the epoch starting January 1, 1970 at 12AM and the latter
> being that of January 1 1900 12AM.
>
> In summary my equation is this:
>
> /* Seconds between 1970 and 1900 (with 17 leap years) */
> uint64_t epoch_difference = (365 + 17) * 24 * 60 * 60;

You mean (365*(1970-1900) + 17) * 24 * 60 * 60, don't you? :)

Gabor





More information about the questions mailing list