From owner-freebsd-standards Fri Apr 12 11:57:41 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mail.tgd.net (mail.tgd.net [209.81.25.10]) by hub.freebsd.org (Postfix) with ESMTP id 8222E37B404 for ; Fri, 12 Apr 2002 11:57:39 -0700 (PDT) Received: by mail.tgd.net (Postfix, from userid 1001) id 9F48120F07; Fri, 12 Apr 2002 11:57:38 -0700 (PDT) Date: Fri, 12 Apr 2002 11:57:38 -0700 From: Sean Chittenden To: Garrett Wollman Cc: freebsd-standards@FreeBSD.ORG Subject: Re: mktime() doesn't fix deadzones... Message-ID: <20020412115738.F73286@ninja1.internal> References: <200204101233.g3ACXaOF052655@hak.lan.Awfulhak.org> <20020410125409.B34587@ninja1.internal> <200204102028.g3AKS5h68482@khavrinen.lcs.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <200204102028.g3AKS5h68482@khavrinen.lcs.mit.edu>; from "wollman@lcs.mit.edu" on Wed, Apr 10, 2002 at = 04:28:05PM X-PGP-Key: 0x1EDDFAAD X-PGP-Fingerprint: C665 A17F 9A56 286C 5CFB 1DEA 9F4F 5CEF 1EDD FAAD X-Web-Homepage: http://sean.chittenden.org/ Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > I like that mktime() returns -1 for invalid times, but I don't > > think Apr 7th @2am-8 is an invalid time. Not correct, but not > > invalid either. > > There is no such time as 2001-04-07T0200 when US DST rules are used. > This time simply does not exist, and mktime() correctly returns an > error. It has no way of knowing that you ``really meant'' > 2001-04-07T0300. There is no February 29th most years, but if you put in Feb 29, it'll automatically figure out that you wanted March 1st. > > Sun Apr 07 02:00:00 PST 2002 =3D 1018173600 > > ...except that PST is not in effect at that time in your timezone. I'm not one to disagree, but when I get handed bogus data, it strikes me as very possible for mktime() to normalize the dates/times. Seems a tad wasteful and unnecessary to have programmers deal with this. I don't particularly want a lecture on timezones from mktime(), I just want it to parse, apply structural rules, normalize the time, and return time_t. If I get time_t, then it's right. I don't really care if my timezone offset is -48hrs or if I put in 36hrs in a day, I want time_t back. Is there another syscall that doesn't validate the data, but returns time_t? Something that more closely conformed with other OSes would be nice for code portability. Have you tried running your code fragment on Sun, Linux, or DEC? -sc -- Sean Chittenden To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message