[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: Noooooo... (localtime in Unix98)



On Tue, Jan 04, 2000 at 11:12:31AM +0100, Bart Schuller wrote:
> This piece of the RISKS digest caught my eye. The "open"software website
> won't let me in to check, unfortunately.
> 
> Date: Mon, 3 Jan 2000 10:56:42 -0500
> From: "John J. Francini" <francini@progress.com>
> Subject: Unix98 localtime
> 
> The problem is that it's not so simple as that.  The UNIX98 standard
> changed the localtime() function so that the year value is redefined to
> be the "year in the current century" rather than "years since 1900".  On
> a system that has been patched to comply with UNIX98 _after_ your
> suggested change was made, the code would break.  It's better to use a
> function that gets the current century and then adds (year % 100) to it,
> or gets the current 4-digit year direct from the OS.  This covers more
> bases.
> 

So, in that implementation would localtime(941083200) return -1 for the
year?

Ronald


References to:
Bart Schuller <schuller@lunatech.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]