This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Re: Y2K question
- To: glibc-linux at ricardo dot ecn dot wfu dot edu
- Subject: Re: Y2K question
- From: Thorsten Kukuk <kukuk at suse dot de>
- Date: Wed, 2 Feb 2000 07:42:55 +0100
- References: <Pine.LNX.4.05.10002020103430.472-100000@linux.home>
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
On Wed, Feb 02, Wolfgang Sourdeau wrote:
> 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 ?
>
Where stands that timeinfo->tm_year mean to be a 2-digit value ?
tm_year is defined as Year - 1900, so everything is correct.
Thorsten
--
Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de
SuSE GmbH Schanzaeckerstr. 10 90443 Nuernberg
Linux is like a Vorlon. It is incredibly powerful, gives terse,
cryptic answers and has a lot of things going on in the background.