From: H. Peter Anvin Date: Mon, 25 Apr 2005 18:46:25 GMT Subject: Re: git.git object database at kernel.org? Message-ID: <426D3B01.8060408@zytor.com> In-Reply-To: Linus Torvalds wrote: > > NOTE! The fact that "mktime()" seems to depend on the timezone in which > it is made seems to make this questionable. I had always assumed that > mktime would take the timezone from the "struct tm", and thus be > reliable, but somebody seems to have shown that that is not the case at > all! > No, mktime() always uses the local time zone. It's the inverse of localtime(). If you know the timezone offset (e.g. if you have a RFC 2822-style date) then you're probably better off rolling your own; otherwise setenv("TZ"); tzset(); mktime(); is of course also doable. -hpa