From owner-freebsd-hackers Tue Jul 23 17:15:45 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id RAA26223 for hackers-outgoing; Tue, 23 Jul 1996 17:15:45 -0700 (PDT) Received: from relay-2.mail.demon.net (disperse.demon.co.uk [158.152.1.77]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id RAA26218 for ; Tue, 23 Jul 1996 17:15:42 -0700 (PDT) Received: from post.demon.co.uk ([158.152.1.72]) by relay-2.mail.demon.net id ab06037; 24 Jul 96 1:15 +0100 Received: from jraynard.demon.co.uk ([158.152.42.77]) by relay-3.mail.demon.net id aa24973; 24 Jul 96 1:14 +0100 Received: (from fhackers@localhost) by jraynard.demon.co.uk (8.7.5/8.6.12) id TAA18599; Tue, 23 Jul 1996 19:26:26 GMT From: James Raynard Message-Id: <199607231926.TAA18599@jraynard.demon.co.uk> Subject: Re: changing localtime() behaviour To: Brandon Gillespie Date: Tue, 23 Jul 1996 19:26:26 +0000 () Cc: freebsd-hackers@freebsd.org In-Reply-To: from "Brandon Gillespie" at Jul 23, 96 09:30:39 am X-Mailer: ELM [version 2.4 PL24 ME8a] Content-Type: text Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > 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.