Re: Timezone with DATE_STRFTIME

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

 



On Mon, Feb 08, 2016 at 10:28:58AM -0500, Jeff King wrote:

> So I think the fix is probably just that we need to feed the zone
> information to strftime via the "struct tm".

Ugh, I forgot how horrible the strftime interface is.

There is no zone information in "struct tm". It gets pulled from the
magic global variable "timezone", and you're supposed to use "tzset" to
set it up. We don't. POSIX says:

  Local timezone information is used as though strftime() called
  tzset().

but on my system that does not seem to be the case. At any rate, our
options are:

  1. Trying to munge a global variable with the timezone information we
     have just for the duration of our strftime call.

or

  2. Admit that strftime's "%z" is crap, and tell people not to use it.

I think I am leaning towards the latter, though unfortunately I don't
think there is a way to find out the author's timezone via
--date=format, then. Perhaps it should default to "--date=format-local:".

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]