From owner-freebsd-hackers Thu Apr 1 16: 6:17 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp-out1.bellatlantic.net (smtp-out1.bellatlantic.net [199.45.39.156]) by hub.freebsd.org (Postfix) with ESMTP id 7BA9D15502 for ; Thu, 1 Apr 1999 16:06:13 -0800 (PST) (envelope-from babkin@bellatlantic.net) Received: from bellatlantic.net (client-117-165.bellatlantic.net [151.198.117.165]) by smtp-out1.bellatlantic.net (8.9.1/8.9.1) with ESMTP id TAA10838; Thu, 1 Apr 1999 19:05:00 -0500 (EST) Message-ID: <37040BB7.56E25907@bellatlantic.net> Date: Thu, 01 Apr 1999 19:13:43 -0500 From: Sergey Babkin X-Mailer: Mozilla 4.07 [en] (X11; I; FreeBSD 3.0-980222-SNAP i386) MIME-Version: 1.0 To: Wes Peters Cc: hackers@FreeBSD.ORG Subject: Re: Y2K issue References: <3702BF79.EE5801AE@bellatlantic.net> <37031575.F7A2399D@softweyr.com> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Wes Peters wrote: > > I do some Y2K testing for my employer, so I have run some of the Y2K > > tests on FreeBSD too. In particular, this one: > > > > ftp://ftp.rdg.opengroup.org/pub/unsupported/stdtools/y2k/ > > > > This directory contains two small tests for the data conversion functions, > > getdate() and strptime(). Getdate() seems to not be supported in FreeBSD > > at all, so it's not a Y2K issue although probably a POSIX conformance > > issue. But strptime() fails. It is supposed to understand the 2-digit > > year from 0 to 38 as years 2000 to 2038. > > Sez who? strptime behaves exactly as the man page says: Sez the Open Group. > > %G is replaced by a year as a decimal number with century. This year > is the one that contains the greater part of the week (Monday as > the first day of the week). > > %g is replaced by the same year as in ``%G'', but as a decimal number > without century (00-99). > > [...] > > %Y is replaced by the year with century as a decimal number. > > %y is replaced by the year without century as a decimal number > (00-99). > > I don't see what could be much more explicit than that. Right, but the man page says about _printing_ in strftime() which can just drop the century. Strptime() is used for parsing, so it has to guess the century from the last two digits. POSIX says that the years 70-99 should be understood as 1970-1999, 00-38 as 2000-2038 and the 39-69 may be understood in either way. This is the thing that users expect, if someone will use the year 01 he obviously will mean 2001, not 1901. -SB To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message