This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Y2K question
- To: glibc-linux <glibc-linux at ricardo dot ecn dot wfu dot edu>
- Subject: Y2K question
- From: Wolfgang Sourdeau <wolfgang at ultim dot net>
- Date: Wed, 2 Feb 2000 01:07:59 -0500 (EST)
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
Hi,
I was wondering why the next code returned 100 as year when current date
is past y2k.
#include <stdio.h>
#include <time.h>
int main()
{
time_t seconds70;
struct tm *timeinfo;
seconds70 = time(&seconds70);
timeinfo = gmtime(&seconds70);
printf( "%.2d/%.2d/%.2d\n",
timeinfo->tm_mday,
(timeinfo->tm_mon + 1),
timeinfo->tm_year);
return 0;
}
Is it to make the difference between 1900 and 2000 ?
In any way, in my sense, it's more of a bug than a feature because
obviously timeinfo->tm_year is mean to be a 2-digits value. Has anyone
any explaination on this ?
Wolfgang
--
Les nombres imitent l'espace, qui est de nature si différente.
Pascal, Pensées