Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Apr 1999 19:13:43 -0500
From:      Sergey Babkin <babkin@bellatlantic.net>
To:        Wes Peters <wes@softweyr.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Y2K issue
Message-ID:  <37040BB7.56E25907@bellatlantic.net>
References:  <3702BF79.EE5801AE@bellatlantic.net> <37031575.F7A2399D@softweyr.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37040BB7.56E25907>