This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] contrib/reg_*: Fix the uses of the date command.


Hi,

Attached is a patch to fix the uses of the date command.

Currently, reg_search (and presumably reg_periodic) converts the epoch
into a human readable form using

  date --date "1970-01-01 00:00:1105874003"

which prints out

  Thu Jan  1 00:00:59 EST 1970

The patch fixes the problem by using

  date --date "1970-01-01 UTC 1105874003 seconds"

which prints out

  Sun Jan 16 06:13:23 EST 2005

IMHO, we should put UTC there because these days both mailing lists
and CVS at gcc.gnu.org use UTC.

I looked at:

http://www.gnu.org/software/coreutils/manual/html_chapter/coreutils_21.html

in particular a section that starts out with "To convert such an
unwieldy number".

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2005-01-16  Kazu Hirata  <kazu@cs.umass.edu>

	* reg_periodic, reg_search: Fix the uses of date command.

Index: reg_periodic
===================================================================
RCS file: /cvs/gcc/gcc/contrib/reghunt/reg_periodic,v
retrieving revision 1.2
diff -u -d -p -r1.2 reg_periodic
--- reg_periodic	24 Jun 2003 17:18:39 -0000	1.2
+++ reg_periodic	16 Jan 2005 11:09:31 -0000
@@ -70,7 +70,7 @@ error() {
 # control tools and report to the user.
 
 make_date() {
-  MADE_DATE="`${DATE} -u +\"%Y-%m-%d %H:%M %Z\" --date \"1970-01-01 00:00:${1}\"`" \
+  MADE_DATE="`${DATE} -u +\"%Y-%m-%d %H:%M %Z\" --date \"1970-01-01 UTC ${1} seconds\"`" \
     || error "make_date: date command failed"
 }
 
Index: reg_search
===================================================================
RCS file: /cvs/gcc/gcc/contrib/reghunt/reg_search,v
retrieving revision 1.2
diff -u -d -p -r1.2 reg_search
--- reg_search	24 Jun 2003 17:18:39 -0000	1.2
+++ reg_search	16 Jan 2005 11:09:31 -0000
@@ -96,7 +96,7 @@ error() {
 # control tools and report to the user.
 
 make_date() {
-  MADE_DATE="`${DATE} -u +\"%Y-%m-%d %H:%M %Z\" --date \"1970-01-01 00:00:${1}\"`" \
+  MADE_DATE="`${DATE} -u +\"%Y-%m-%d %H:%M %Z\" --date \"1970-01-01 UTC ${1} seconds\"`" \
     || error "make_date: date command failed"
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]