Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Aug 1996 21:54:52 +0000 ()
From:      James Raynard <fqueries@jraynard.demon.co.uk>
To:        Archie Cobbs <archie@whistle.com>
Cc:        questions@freebsd.org
Subject:   Re: mktime(3) bug?
Message-ID:  <199608032154.VAA05620@jraynard.demon.co.uk>
In-Reply-To: <199608012340.QAA03973@bubba.whistle.com> from "Archie Cobbs" at Aug 1, 96 04:40:51 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> I'm confused about mktime(3) .. from the man page it appears that
> it should ignore the current timezone of the machine its running
> on, instead getting this information directly from the argument.

As I understand it, mktime() assumes that its argument is given in 
local time and returns a value in UTC.

> In practice, however, it seems to ignore the tm_gmtoff field completely.
 
I can't find anything about the tm_gmtoff field in any of my references
(it's certainly not in ANSI C) so I don't know how it's meant to be
used :-)

[example of passing midnight on 1/1/02 to mktime()]

> On my machine (in California), I get this output:
> 
>     seconds = 2149079296 -> Wed Jan  1 08:00:00 1902
>     seconds = 2149079296 -> Wed Jan  1 08:00:00 1902
 
This seems reasonable - California is 8 hours behind UTC, so midnight
in California is 8am in UTC.

> Also, setting tm_year to 1 causes mktime() to fail.. why?

No idea, sorry!




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