From jin@gracie.lbl.gov  Tue Jan 18 10:33:24 2000
Return-Path: <jin@gracie.lbl.gov>
Received: from gracie.lbl.gov (gracie.lbl.gov [131.243.2.175])
	by hub.freebsd.org (Postfix) with ESMTP id 5AFC514BEF
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Jan 2000 10:33:23 -0800 (PST)
	(envelope-from jin@gracie.lbl.gov)
Received: (from jin@localhost)
	by gracie.lbl.gov (8.9.3/8.9.3) id KAA62614;
	Tue, 18 Jan 2000 10:33:22 -0800 (PST)
	(envelope-from jin)
Message-Id: <200001181833.KAA62614@gracie.lbl.gov>
Date: Tue, 18 Jan 2000 10:33:22 -0800 (PST)
From: Jin Guojun (FTG staff) <jin@gracie.lbl.gov>
Reply-To: j_guojun@lbl.gov
To: FreeBSD-gnats-submit@freebsd.org
Subject: Y#K of tm_year returned by localtime()
X-Send-Pr-Version: 3.2

>Number:         16182
>Category:       misc
>Synopsis:       Y#K of tm_year returned by localtime()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 18 10:40:01 PST 2000
>Closed-Date:    Tue Jan 18 14:31:14 EST 2000
>Last-Modified:  Tue Jan 18 14:33:00 EST 2000
>Originator:     Jin Guojun (FTG staff)
>Release:        FreeBSD 3.4-20000104-STABLE i386
>Organization:
>Environment:

	All FreeBSD Releases

>Description:

% ll Makefile
-rw-r--r--  1 jin  2294 Jan 18 09:59 Makefile

	stat(file_name, &f_stat);
	ftm = localtime(&f_stat.st_mtime);

(xxgdb) print *ftm
$3 = {
  tm_sec = 22, 
  tm_min = 44, 
  tm_hour = 9, 
  tm_mday = 18, 
  tm_mon = 0, 
  tm_year = 100, 
  tm_wday = 2, 
  tm_yday = 17, 
  tm_isdst = 0, 
  tm_gmtoff = -28800, 
  tm_zone = 0x20158f30 "PST"
}

>How-To-Repeat:

	

>Fix:
	
	Question:
	Shall we set the tm_year value to four digits by adding 1900?
	or Is the user resposible to add 1900 to the tm_year in program?


>Release-Note:
>Audit-Trail:

From: Ruslan Ermilov <ru@ucb.crimea.ua>
To: j_guojun@lbl.gov
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: misc/16182: Y#K of tm_year returned by localtime()
Date: Tue, 18 Jan 2000 20:55:42 +0200

 On Tue, Jan 18, 2000 at 10:33:22AM -0800, Jin Guojun wrote:
 > 
 > >Number:         16182
 > >Category:       misc
 > >Synopsis:       Y#K of tm_year returned by localtime()
 > >Severity:       serious
 > >Release:        FreeBSD 3.4-20000104-STABLE i386
 > 
 [...]
 > >Description:
 > 
 > % ll Makefile
 > -rw-r--r--  1 jin  2294 Jan 18 09:59 Makefile
 > 
 > 	stat(file_name, &f_stat);
 > 	ftm = localtime(&f_stat.st_mtime);
 > 
 > (xxgdb) print *ftm
 > $3 = {
 >   tm_sec = 22, 
 >   tm_min = 44, 
 >   tm_hour = 9, 
 >   tm_mday = 18, 
 >   tm_mon = 0, 
 >   tm_year = 100, 
 >   tm_wday = 2, 
 >   tm_yday = 17, 
 >   tm_isdst = 0, 
 >   tm_gmtoff = -28800, 
 >   tm_zone = 0x20158f30 "PST"
 > }
 > 
 Read the ctime(3) manpage:
 [...]
 	   int tm_mday;    /* day of month (1 - 31) */
 	   int tm_mon;	   /* month of year (0 - 11) */
 	   int tm_year;    /* year - 1900 */
 	   int tm_wday;    /* day of week (Sunday = 0) */
 	   int tm_yday;    /* day of year (0 - 365) */
 [...]
 
 > >Fix:
 > 	
 > 	Question:
 > 	Shall we set the tm_year value to four digits by adding 1900?
 > 	or Is the user resposible to add 1900 to the tm_year in program?
 > 
 The PR system is probably not a good place to ask questions.
 
 -- 
 Ruslan Ermilov		Sysadmin and DBA of the
 ru@ucb.crimea.ua	United Commercial Bank,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.247.647	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
 
State-Changed-From-To: open->closed 
State-Changed-By: mph 
State-Changed-When: Tue Jan 18 14:31:14 EST 2000 
State-Changed-Why:  
Correctly written software adds 1900 to tm_year to obtain a four-digit 
year.  Changing localtime(3) in the way you describe will break all 
existing correctly-written software with no benefit. 
>Unformatted:
