amd64/109584: [patch] zdump(8) doesn't work
Edwin Groothuis
edwin at mavetju.org
Wed Sep 17 13:10:06 UTC 2008
The following reply was made to PR amd64/109584; it has been noted by GNATS.
From: Edwin Groothuis <edwin at mavetju.org>
To: bug-followup at FreeBSD.org, dcrandall at 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 at mavetju.org | Weblog: http://www.mavetju.org/weblog/
More information about the freebsd-amd64
mailing list