[tz] [PROPOSED PATCH] Support %z in Zone formats

Phil Ross phil.ross at gmail.com
Tue Aug 11 23:40:10 UTC 2015


On 20/07/2015 04:23, Paul Eggert wrote:
> This extends the zic input format to add support for %z, which
> expands to a UTC offset in as-short-as-possible ISO 8601 format.

Is there a discrepancy between the documented and actual sign used for 
the %z format?

With this change, the zic.8 man page now states under FORMAT:

'hh, mm, and ss are the hours, minutes, and seconds east (+) or west (−) 
of UTC.'

However, the doabbr function negates zp->z_gmtoff before calling abbroffset:

> +	  if (zp->z_format_specifier == 'z')
> +	    letters = abbroffset(letterbuf, -zp->z_gmtoff);

abbroffset uses '+' as the sign for a positive offset and '-' for a 
negative offset:

 > +static char const *
 > +abbroffset(char *buf, zic_t offset)
 > +{
 > +  char sign = '+';
 > +
 > +  if (offset < 0) {
 > +    offset = -offset;
 > +    sign = '-';
 > +  }

Therefore, won't zic be generating + for west of UTC and − for east 
instead of the documented behaviour?

Phil





More information about the tz mailing list