Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Sep 2008 13:10:06 GMT
From:      Edwin Groothuis <edwin@mavetju.org>
To:        freebsd-amd64@FreeBSD.org
Subject:   Re: amd64/109584: [patch] zdump(8) doesn't work
Message-ID:  <200809171310.m8HDA6qh077420@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR amd64/109584; it has been noted by GNATS.

From: Edwin Groothuis <edwin@mavetju.org>
To: bug-followup@FreeBSD.org, dcrandall@simplestar.com
Cc:  
Subject: Re: amd64/109584: [patch] zdump(8) doesn't work
Date: Wed, 17 Sep 2008 23:01:55 +1000

 Forgot the last data to be displayed.
 
 Index: zdump.c
 ===================================================================
 --- zdump.c	(revision 183065)
 +++ zdump.c	(working copy)
 @@ -96,6 +96,10 @@
  #endif /* !defined GNUC_or_lint */
  #endif /* !defined INITIALIZE */
  
 +/* For architectures >32 bit, start at 1900 and go to 2100 */
 +#define	EPOCH1900	-2209024800	/* Mon Jan  1 00:00:00 EST 1900 */
 +#define	EPOCH2100	4102405200	/* Fri Jan  1 00:00:00 EST 2100 */
 +
  /*
  ** For the benefit of GNU folk...
  ** `_(MSGID)' uses the current locale's message library string for MSGID.
 @@ -151,7 +155,9 @@
  	time_t			hibit;
  	struct tm		tm;
  	struct tm		newtm;
 +	int			cpu32;
  
 +	cpu32 = (sizeof(NULL) == 4);
  	INITIALIZE(cuttime);
  #if HAVE_GETTEXT - 0
  	(void) setlocale(LC_MESSAGES, "");
 @@ -222,9 +228,18 @@
  		/*
  		** Get lowest value of t.
  		*/
 -		t = hibit;
 -		if (t > 0)		/* time_t is unsigned */
 -			t = 0;
 +		if (cpu32) {
 +			t = hibit;
 +			if (t > 0)		/* time_t is unsigned */
 +				t = 0;
 +		} else {
 +			t = EPOCH1900;		/* 1 January 1900 00:00:00 */
 +			if (cutoff == NULL) {
 +				cuttime = EPOCH2100;
 +				cutoff = "2099";
 +			}
 +		}
 +
  		show(argv[i], t, TRUE);
  		t += SECSPERHOUR * HOURSPERDAY;
  		show(argv[i], t, TRUE);
 @@ -253,9 +268,13 @@
  		/*
  		** Get highest value of t.
  		*/
 -		t = ~((time_t) 0);
 -		if (t < 0)		/* time_t is signed */
 -			t &= ~hibit;
 +		if (cpu32) {
 +			t = ~((time_t) 0);
 +			if (t < 0)		/* time_t is signed */
 +				t &= ~hibit;
 +		} else {
 +			t = EPOCH2100 - 1;
 +		}
  		t -= SECSPERHOUR * HOURSPERDAY;
  		show(argv[i], t, TRUE);
  		t += SECSPERHOUR * HOURSPERDAY;
 
 -- 
 Edwin Groothuis      |            Personal website: http://www.mavetju.org
 edwin@mavetju.org    |              Weblog: http://www.mavetju.org/weblog/



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