apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: apr_strftime not portable
Date Wed, 17 Jul 2002 19:38:10 GMT
Jim Jagielski <jim@jaguNET.com> writes:

> Ryan Morgan wrote:
> > 
> > 
> > apr_strftime calls the platform's native strftime, which differs between
> > platforms (solaris and linux for example).  take the following code:
> > 
> > apr_explode_localtime(&xt, apr_time_now());
> > apr_strftime(buf, &retcode, sizeof(buf), "%G", &xt);
> > 
> > this will result in buf containing '2002' on linux and '%G' on solaris.
> > (because solaris strftime does not support %G, but linux does)
> > 
> 
> IIRC, '%G' is not ANSI, but an extension on Linux and some others.
> Solaris doesn't have it, neither does Darwin. What's the diff between
> %G and %Y (year with century)?

Linux:

       %G     The  ISO  8601  year  with century as a decimal number.  The 4-digit year corre-
              sponding to the ISO week number (see %V).  This has the same format and value
as
              %y,  except  that  if  the ISO week number belongs to the previous or next year,
              that year is used instead. (TZ)

FreeBSD:

     %G    is replaced by a year as a decimal number with century.  This year
           is the one that contains the greater part of the week (Monday as
           the first day of the week).

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Mime
View raw message