This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Y2K question


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]