[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: Noooooo... (localtime in Unix98)
At 11:12 +0100 2000-01-04, Bart Schuller wrote:
>This piece of the RISKS digest caught my eye. The "open"software website
>won't let me in to check, unfortunately.
After jumping through a number of tedious hoops, it is possible for
non-members to get on-line access to standards at
<http://www.opengroup.org>. Belatedly, I've got around to doing this.
From RISKS:
>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".
Not true:
From UNIX98 localtime():
#include <time.h>
struct tm *localtime(const time_t *timer);
From UNIX98 time.h:
The <time.h> header declares the structure tm, which includes at
least the following members:
int tm_sec seconds [0,61]
int tm_min minutes [0,59]
int tm_hour hour [0,23]
int tm_mday day of month [1,31]
int tm_mon month of year [0,11]
int tm_year years since 1900
int tm_wday day of week [0,6] (Sunday = 0)
int tm_yday day of year [0,365]
int tm_isdst daylight savings flag
At 17:29 +0000 2000-01-04, M.J.T. Guy wrote:
>I don't know anything about UNIX98, but this looks like typical FUD
>to me. Any system that defines localtime() like (or to be pedantic,
>struct tm) is in violation of ANSI C. So I don't believe it.
Justifiably. The only wrinkle is that a conforming implementation is
allowed to add fields giving century number and year in century if it
wants. Hell, it can add a field giving the phase of the moon if it
wants -- useful for bug-hunting. So maybe somebody's done that.
But, if they have, we can ignore it.
--
Dominic Dunlop
- Follow-Ups from:
-
Bennett Todd <bet@rahul.net>
- References to:
-
Bart Schuller <schuller@lunatech.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]