Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jul 1996 19:26:26 +0000 ()
From:      James Raynard <fhackers@jraynard.demon.co.uk>
To:        Brandon Gillespie <brandon@tombstone.sunrem.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: changing localtime() behaviour
Message-ID:  <199607231926.TAA18599@jraynard.demon.co.uk>
In-Reply-To: <Pine.BSF.3.91.960723092923.19204A-100000@tombstone.sunrem.com> from "Brandon Gillespie" at Jul 23, 96 09:30:39 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> How would one go about changing the behavior of localtime() so that
> the value for struct tm.tm_year has the thousands in the year, ala '1996' 
> rather than just '96'?

Actually, the tm_year field is the number of years since 1900,
which is not the same as the last two digits in the year (eg the
year 2007 would have a tm_year value of 107).  So if you're doing
this to find out which century you're in, that problem has
already been solved for you!

Also, changing this would break compatibility with ISO C or POSIX,
and may cause other programs to work incorrectly.

If you really want to hack around with the source, it's in
/usr/src/lib/libc/stdtime, but I'd recommend writing your own
function rather than messing around with the system one.




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