# Re: git pull on ia64 linux tree

2 messages from 2005-04-22 to 2005-04-24. Participants: Linus Torvalds, Sanjoy Mahajan.
Thread: https://gitlist.dev/t/253

## Linus Torvalds, 2005-04-22 22:34

Subject: Re: git pull on ia64 linux tree
Message-ID: <Pine.LNX.4.58.0504221521260.2344@ppc970.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.58.0504221521260.2344%40ppc970.osdl.org
In-Reply-To: <200504222203.j3MM3fV17003@unix-os.sc.intel.com>

```


On Fri, 22 Apr 2005 tony.luck@intel.com wrote:
> 
> "git log" seems to have problems interpreting the dates ... looking at the
> commit entries, the time is right ... but it appears that git log applies
> the timezone correction twice, so the changes I just applied at 14:46 PDT
> look like I made them at quarter to five tomorrow morning (+14 hours from
> when I did).

Looks like you are right.

The seconds are already in UTC format, so I think "git log" is wrong to 
pass the UTC seconds in to "date", and then tell date that it was done in 
the original timezone.

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"

or whatever. Sadly, it looks like "date" doesn't understand timezone 
syntax like that - looks like TZ has to be in the long machine-unreadable 
format like "US/Pacific" etc. Stupid (either TZ or me - maybe I just 
don't know what the right format is).

		Linus

```

## Sanjoy Mahajan, 2005-04-24 05:02

Subject: Re: git pull on ia64 linux tree
Message-ID: <E1DPZGY-0000VJ-00@skye.ra.phy.cam.ac.uk>
URL: https://gitlist.dev/e/E1DPZGY-0000VJ-00%40skye.ra.phy.cam.ac.uk
In-Reply-To: <Pine.LNX.4.58.0504221521260.2344@ppc970.osdl.org>

```
> 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

```
