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

Noooooo... (localtime in Unix98)



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.

John Francini, francini@progress.com

-- 
The idea is that the first face shown to people is one they can readily
accept - a more traditional logo. The lunacy element is only revealed
subsequently, via the LunaDude. [excerpted from the Lunatech Identity Manual]


Follow-Ups from:
Ronald J Kimball <rjk@linguist.dartmouth.edu>

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