[ntp:questions] Re: Jonathan Buzzard's radioclkd and FreeBSD

Wolfgang S. Rupprecht wolfgang+gnus20031109T120217 at dailyplanet.dontspam.wsrcc.com
Sun Nov 9 20:14:15 UTC 2003

Hans Jørgen Jakobsen <hjj at wheel.dk> writes:
>>       dectimet = timegm ( &dectime );

Thanks for posting this.  I hadn't realized that libc() had an
undocumented utc version of mktime().  Up to this point I'd been using
this following hack to fix up the offset.

    tm->tm_isdst = -1;
    time = mktime(tm);
    if (time >= 0) {
	time += tm->tm_gmtoff;

Seeing how much work libc/time/localtime.c:mktime() does to generate
the time with the offset, using timegm() is clearly superior.

Wolfgang S. Rupprecht 		     http://www.wsrcc.com/wolfgang/
           The From: address is valid.  Don't mess with it.
irony: when the richest man in the world is struck using Microsoft products

More information about the questions mailing list