|
From: | Zack Weinberg |
Subject: | [Monotone-devel] Re: cvs_import and timezones |
Date: | Tue, 17 Oct 2006 14:42:26 -0700 |
On 10/17/06, Tony Tung <address@hidden> wrote:
> Uh, what??? It should not be necessary to call tzset() by hand; libc > does it automatically on the first use of a function that needs time > zone info, e.g. localtime(). This appears to be a platform-dependent issue. On my Linux box, the manpage for tzset indicates that it is automatically called. On the other hand, neither my OSX laptop nor my FreeBSD box says that it is automatically called.
Whether the manpage says it or not, I can pretty much guarantee you libc does do this automatically on OSX and FreeBSD. If it didn't, the majority of programs that used localtime() would not work properly. Straightforward test program follows - I will be surprised if the two lines it prints are different on any system at all (note that it does nothing interesting if TZ=UTC). zw #include <time.h> #include <stdio.h> int main(void) { time_t now = time(0); fputs(ctime(&now), stdout); tzset(); fputs(ctime(&now), stdout); return 0; }
[Prev in Thread] | Current Thread | [Next in Thread] |