Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

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

 



Am 07.06.2017 um 10:17 schrieb Jeff King:
On Sat, Jun 03, 2017 at 12:40:34PM +0200, René Scharfe wrote:
Duplicates strbuf_expand to a certain extent, but not too badly, I
think.  Leaves the door open for letting strftime handle the local
case.

I guess you'd plan to do that like this in the caller:

   if (date->local)
	tz_name = NULL;
   else
	tz_name = "";

and then your strftime() doesn't do any %z expansion when tz_name is
NULL.

Yes, or you could look up a time zone name somewhere else -- except we
don't have a way to do that, at least for now.

I was thinking that we would need to have it take the actual time_t, and
then it would be able to do the tzset/localtime dance itself. But since
I don't think we're planning to do that (if anything we'd just handle
the normal localtime() case), the complication it would add to the
interface isn't worth it.

A caller that really needs to do that can, and pass the result as a
string.  Not pretty, but at least it's a possibility.

René



[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]