You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ryan Morgan <rm...@covalent.net> on 2002/07/17 21:15:34 UTC

apr_strftime not portable

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)

any ideas on how we can (or if we should) fix this?  i think due to the
differences between platforms we would probably need to implement our own
strftime.  ideas?

-Ryan

Re: apr_strftime not portable

Posted by Jeff Trawick <tr...@attglobal.net>.
Ryan Morgan <rm...@covalent.net> writes:

> 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);

so we could document which format strings we support (limit it to
ANSI for portability)

alternatively:

http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdtime/strftime.c

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

RE: apr_strftime not portable

Posted by Ryan Bloom <rb...@covalent.net>.
We should fix this, without a doubt.  Please file a bug in the bug
system at http://nagoya.apache.org so that this can be tracked.

Ryan

----------------------------------------------
Ryan Bloom                  rbb@covalent.net
645 Howard St.              rbb@apache.org
San Francisco, CA 

> -----Original Message-----
> From: Ryan Morgan [mailto:rmorgan@covalent.net]
> Sent: Wednesday, July 17, 2002 12:16 PM
> To: dev@apr.apache.org
> Subject: apr_strftime not portable
> 
> 
> 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)
> 
> any ideas on how we can (or if we should) fix this?  i think due to
the
> differences between platforms we would probably need to implement our
own
> strftime.  ideas?
> 
> -Ryan