Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Oct 2008 14:46:23 -0400
From:      "Mark B." <mkbucc@gmail.com>
To:        "Jeremy Chadwick" <koitsu@freebsd.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: mktime() output not the same as the date utility
Message-ID:  <59f4cb420810141146r53c7527i8becf67ece89ab95@mail.gmail.com>
In-Reply-To: <20081014175040.GA55591@icarus.home.lan>
References:  <59f4cb420810140943r113f1494la477606c004833ca@mail.gmail.com> <20081014175040.GA55591@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 14, 2008 at 1:50 PM, Jeremy Chadwick <koitsu@freebsd.org> wrote:
> On Tue, Oct 14, 2008 at 12:43:54PM -0400, Mark B. wrote:
>> I can't figure out from the man pages why
>> mktime() is giving a different result than date -f.
>> Both strptime and mktime are supposed to use the
>> local timezone, as does date.
>>
>> The output of date is correct; mktime() is an hour later.
>>
>> What am I missing here?
>
> I'm betting it's due to DST
>

Yes, set tm_isdst to -1 before calling mktime() and then my
test program works as expected.

Thanks,

m



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?59f4cb420810141146r53c7527i8becf67ece89ab95>