[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Time zone trouble without time zones being involved

From: Yuri Khan
Subject: Re: Time zone trouble without time zones being involved
Date: Tue, 17 May 2016 21:31:21 +0600

On Tue, May 17, 2016 at 8:57 PM, Michael Heerdegen
<> wrote:

> Hmm, I hoped I can do without a shell.
> Do you think the unixtime value as printed in
>   git log --pretty=format:%ad --date=raw -n1
> can be relied on?  Can I ignore the printed time zone delta?

In my limited testing, the timestamp seems to match the one in the commit.

The timestamp identifies the exact moment in universal time when the
commit was made. The time zone offset is only stored for the benefit
of tools which want to display commit times in their author and
committer’s time zones in effect at that moment (which might or might
not coincide with the user’s time zone offset in effect at the time of

So yes, you can ignore the offset. But you still need something in
order to strip it off, either shell or string manipulation.

> [BTW, the doc of git-log tells that
>   --date=raw shows the date in the internal raw Git format %s %z format.
> but this seems to be a different %s because raw shows a different time]

I don’t even think any date arithmetic happens with --date=raw. The
information is already there in the commit data, in this exact format,
Git probably only extracts it with string operations.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]