git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [Bug] git log - reports wrong date and time
@ 2019-04-01 22:31 Chanseok Oh
  2019-04-02  0:38 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Chanseok Oh @ 2019-04-01 22:31 UTC (permalink / raw)
  To: git

Hello,

I'm using the latest version.

    $ git version
    git version 2.21.0.392.gf8f6787159e-goog

WORKS: the following prints out the date and time in my local timezone.

    $ git log '--date=format-local:%Y%m%d %H%M%S %z (%Z)' --format=%cd -n1
    20190401 170250 -0400 (EDT)

WORKS: "TZ=UTC" is respected. It prints time in UTC.

    $ TZ=UTC git log '--date=format-local:%Y%m%d %H%M%S %z (%Z)'
--format=%cd -n1
    20190401 210250 +0000 (UTC)

BROKEN: anything other than UTC reports wrong date.

    $ TZ=KST git log '--date=format-local:%Y%m%d %H%M%S %z (%Z)'
--format=%cd -n1
    20190401 210250 +0000 (KST)

The time is in UTC. Worse, %Z respects TZ=KST, which is in conflict with %z.

The symptom is same with "--date=local". It respects TZ=UTC but
nothing other than TZ=UTC.

Regards,
Chanseok

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Bug] git log - reports wrong date and time
  2019-04-01 22:31 [Bug] git log - reports wrong date and time Chanseok Oh
@ 2019-04-02  0:38 ` Junio C Hamano
  2019-04-02 14:59   ` Chanseok Oh
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2019-04-02  0:38 UTC (permalink / raw)
  To: Chanseok Oh; +Cc: git

Chanseok Oh <chanseok@google.com> writes:

> BROKEN: anything other than UTC reports wrong date.
>
>     $ TZ=KST git log '--date=format-local:%Y%m%d %H%M%S %z (%Z)'
> --format=%cd -n1
>     20190401 210250 +0000 (KST)

I think you are probably on a system where timezones can be given
only with a more modern and unambiguous style and not in the
potentially ambiguous abbreviated form.  Here is one experiment to
show what I mean:

    $ TZ=KST date
    Tue Apr  2 00:29:51 KST 2019
    $ TZ=JST date
    Tue Apr  2 00:29:51 JST 2019
    $ TZ=Asia/Tokyo date
    Tue Apr  2 09:29:51 JST 2019

Two points to be learned from the above exercise are:

 - It is not limited to your copy of "git".  Even a system supplied
   command like "date" does not work with "JST" but it can grok
   Asia/Tokyo just fine ("JST" does not necessarily have to be
   "Japan standard time"; it could be Jamaican ;-)).

 - It is not limited to KST (is that Kabul standard time?  Khartoum?
   Kinshasa?).

Perhaps try TZ=Asia/Seoul or something?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Bug] git log - reports wrong date and time
  2019-04-02  0:38 ` Junio C Hamano
@ 2019-04-02 14:59   ` Chanseok Oh
  0 siblings, 0 replies; 3+ messages in thread
From: Chanseok Oh @ 2019-04-02 14:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Turns out I wasn't using TZ in the right way. One of the formats for
TZ is std offset, where std string specifies the name of the time zone
(such as EDT, PDT, KST, or JST) and offset is the time that should be
added to get UTC. In this format, you specify the time zone
information directly, which means, it is your responsibility to
specify the correct time zone information. Below demonstrates how this
format works:

$ TZ=UTS-3 date

$ TZ=KST-7:30 date

$ TZ=JST+12:22:12 date

Thanks for you response anyway, and sorry for the noise.


On Mon, Apr 1, 2019 at 8:38 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Chanseok Oh <chanseok@google.com> writes:
>
> > BROKEN: anything other than UTC reports wrong date.
> >
> >     $ TZ=KST git log '--date=format-local:%Y%m%d %H%M%S %z (%Z)'
> > --format=%cd -n1
> >     20190401 210250 +0000 (KST)
>
> I think you are probably on a system where timezones can be given
> only with a more modern and unambiguous style and not in the
> potentially ambiguous abbreviated form.  Here is one experiment to
> show what I mean:
>
>     $ TZ=KST date
>     Tue Apr  2 00:29:51 KST 2019
>     $ TZ=JST date
>     Tue Apr  2 00:29:51 JST 2019
>     $ TZ=Asia/Tokyo date
>     Tue Apr  2 09:29:51 JST 2019
>
> Two points to be learned from the above exercise are:
>
>  - It is not limited to your copy of "git".  Even a system supplied
>    command like "date" does not work with "JST" but it can grok
>    Asia/Tokyo just fine ("JST" does not necessarily have to be
>    "Japan standard time"; it could be Jamaican ;-)).
>
>  - It is not limited to KST (is that Kabul standard time?  Khartoum?
>    Kinshasa?).
>
> Perhaps try TZ=Asia/Seoul or something?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-02 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 22:31 [Bug] git log - reports wrong date and time Chanseok Oh
2019-04-02  0:38 ` Junio C Hamano
2019-04-02 14:59   ` Chanseok Oh

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).