Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Apr 1998 09:02:38 -0500
From:      Zach Heilig <zach@gaffaneys.com>
To:        Karl Pielorz <kpielorz@tdx.co.uk>, freebsd-bugs@FreeBSD.ORG
Subject:   Re: Year 2000 Compliance - localtime?
Message-ID:  <19980426090238.36619@gaffaneys.com>
In-Reply-To: <354315FC.7532C42D@tdx.co.uk>; from Karl Pielorz on Sun, Apr 26, 1998 at 12:09:48PM %2B0100
References:  <354315FC.7532C42D@tdx.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Apr 26, 1998 at 12:09:48PM +0100, Karl Pielorz wrote:
> int tm_year;    /* year - 1900 */

> Printing the contents of the 'tm_year' only gives the last two digits of the
> year, i.e. it returns '98' at the moment...

> Is this right? - or are there some better functions or something I should be
> using?

Presumably, this will continue to increase: 100, 101, 102 (for 2000, 2001,
2002).  My book that contains the 'iso C' standard is packed away at the
moment, but I'm pretty positive that's what it says is supposed to happen.
(and this is what seems to happen currently:)

#include <stdio.h>
#include <time.h>
int main(void)
{
  struct tm test;

  test.tm_sec = 23;
  test.tm_min = 53;
  test.tm_hour = 15;
  test.tm_mday = 10;
  test.tm_mon = 2;
  test.tm_year = 105;
  test.tm_wday = 4;
  test.tm_yday = 42;
  test.tm_isdst = 0;
  test.tm_zone = "CST";
  test.tm_gmtoff = 21600;

  printf("Date is: %s", asctime(&test));

  return 0;
}

-- 
Zach Heilig -- zach@gaffaneys.com
Real Programs don't use shared text.  Otherwise, how can they use
functions for scratch space after they are finished calling them?

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980426090238.36619>