Re: git pull on ia64 linux tree
- From
- Sanjoy Mahajan <sanjoy@mrao.cam.ac.uk>
- Date
- Apr 24, 2005, 05:02 UTC
- Message-ID
- <E1DPZGY-0000VJ-00@skye.ra.phy.cam.ac.uk>
- In-Reply-To
- <Pine.LNX.4.58.0504221521260.2344@ppc970.osdl.org>
Show 6 quoted lines
> I think it would be nice to use the TZ data to show the thing in the > timezone of the committer, though. Dunno how to do that, maybe > something like > TZ=$tz date -d "1970-01-01 + $sec sec" > Sadly, it looks like "date" doesn't understand timezone syntax like > that
Try:
negzone=`echo $tz | tr '[-]+' '+-'` date -u -R -d "1970-01-01 $negzone + $sec sec" | sed "s/+0000/$tz/"
Or as a script:
#!/bin/bash # usage: show-date.sh <utcseconds> <zone> negzone=`echo $2 | tr '[-]+' '+-'` date -u -R -d "1970-01-01 $negzone + $1 sec" | sed "s/+0000/$2/"
A simple test:
$ show-date.sh 10 +0200 Thu, 01 Jan 1970 02:00:10 +0200
Negating the timezone is an ugly workaround for date not understanding a sensible TZ format. I almost always use -u with date, otherwise I get confused about what timezone it is using to interpret and to print the date.
-Sanjoy