From owner-freebsd-questions Sun Aug 4 01:59:38 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id BAA23485 for questions-outgoing; Sun, 4 Aug 1996 01:59:38 -0700 (PDT) Received: from relay-4.mail.demon.net (relay-4.mail.demon.net [158.152.1.108]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id BAA23479 for ; Sun, 4 Aug 1996 01:59:35 -0700 (PDT) Received: from post.demon.co.uk ([158.152.1.72]) by relay-4.mail.demon.net id aa08120; 4 Aug 96 8:59 GMT Received: from jraynard.demon.co.uk ([158.152.42.77]) by relay-3.mail.demon.net id aa17304; 4 Aug 96 9:56 +0100 Received: (from fqueries@localhost) by jraynard.demon.co.uk (8.6.12/8.6.12) id VAA05620; Sat, 3 Aug 1996 21:54:53 GMT From: James Raynard Message-Id: <199608032154.VAA05620@jraynard.demon.co.uk> Subject: Re: mktime(3) bug? To: Archie Cobbs Date: Sat, 3 Aug 1996 21:54:52 +0000 () Cc: questions@freebsd.org In-Reply-To: <199608012340.QAA03973@bubba.whistle.com> from "Archie Cobbs" at Aug 1, 96 04:40:51 pm X-Mailer: ELM [version 2.4 PL24 ME8a] Content-Type: text Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > 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!