mktime() output not the same as the date utility

Mark B. mkbucc at gmail.com
Tue Oct 14 11:46:24 PDT 2008


On Tue, Oct 14, 2008 at 1:50 PM, Jeremy Chadwick <koitsu at 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


More information about the freebsd-questions mailing list