Date: Thu, 16 Dec 1999 13:20:02 -0800 (PST) From: Andre Albsmeier <andre.albsmeier@mchp.siemens.de> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/15520: mktime() fails under certain conditions Message-ID: <199912162120.NAA36082@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/15520; it has been noted by GNATS. From: Andre Albsmeier <andre.albsmeier@mchp.siemens.de> To: Poul-Henning Kamp <phk@critter.freebsd.dk> Cc: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>, FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/15520: mktime() fails under certain conditions Date: Thu, 16 Dec 1999 22:14:11 +0100 On Thu, 16-Dec-1999 at 21:52:17 +0100, Poul-Henning Kamp wrote: > In message <19991216213647.A34480@internal>, Andre Albsmeier writes: > >On Thu, 16-Dec-1999 at 21:24:41 +0100, Poul-Henning Kamp wrote: > >> In message <199912162016.VAA97593@internal>, Andre Albsmeier writes: > >> > >> There is no 02:00:00 that night. If they test for that, they're > >> crazy. > > > >Yes, the time does not exist. However, I only wonder it our > >behaviour of returning an error is correct in this case. I don't > >trust the GNU/Linux guys as much as I trust FreeBSD :-) but there > >might be a reason they are testing it. > > > >I was already asked in private email if the mktime() should > >succeed according to POSIX.1... Does somebody know anything > >about that? > > Well, Hum. It seems to say that the fields are not constrained > to their normal domains: > > The original values of the tm_wday and tm_yday components > of the structure are ignored, and the original values of > the other components are not restricted to the ranges > described in the <time.h> entry. > > It does not describe what should happen if I ask it to make a time > out of 25:100:100, but I guess most of us can agree what it should > do. > > The trouble with passing it 02:00:00 or for that matter 02:59:00 > on the "spring forward" night, is that the time doesn't exist in > the first place: Ie, does 02:10:00 represent > > 01:59:59 + 10:59 = 03:10:00 > or > 03:00:00 - 50:00 = 01:10:00 > > Since no sane argument either way really holds water, I think > returning an error is correct. I just tried to find out how HP-UX 10.20 and IRIX 5.3 interpret this; they both behave in the same way: When setting tm_hour to 2 (the illegal value) the result is 891766800. When using 1 for tm_hour we also get 891766800. When using 0 for tm_hour we get 891763200, this is -3600 from above. When using 3 for tm_hour the result is 891770400, this is +3600 compared to the first two. These two interpret the setting of tm_hour to 2 as 1. (That doesn't imply that I think this is correct). -Andre To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912162120.NAA36082>