Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jul 1996 09:13:01 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        sjr@zombie.ncsc.mil
Cc:        freebsd-bugs@freefall.freebsd.org
Subject:   Re: misc/1380: Year 2000 breakage with tm_year
Message-ID:  <199607110713.JAA14194@uriah.heep.sax.de>
In-Reply-To: <199607110200.TAA05744@freefall.freebsd.org> from "Stephen J. Roznowski" at "Jul 10, 96 07:00:01 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
As Stephen J. Roznowski wrote:

>  > > 				reply(213,
>  > > ! 					    "%04d%02d%02d%02d%02d%02d",
>  > > ! 					    1900+t->tm_year, t->tm_mon+1, t->tm_mday,
>  > 
>  > Isn't there a TM_YEAR_BASE symbol defined somewhere that should
>  > be used instead of a hardcoded 1900?
>  
>  When I submitted my original changes to NetBSD, I used that symbol;
>  however, according to "J.T. Conklin <jtc@NetBSD.ORG>" the definition
>  of the tm_year field is "years since 1900" according to Standard C.
>  [and not years since TM_YEAR_BASE]

This is right (and points out the sillyness of the standard -- year
2012 will be encoded as 112 then).  Anyway, TM_YEAR_BASE is what our
library uses when computing this field, so it's safe to also use it
for the reverse calculation.  In effect, the ANSI C standard mandates
that TM_YEAR_BASE will always remain at 1900.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607110713.JAA14194>