On Mon, 16 Oct 2000, David E. Wheeler wrote:

> Matt Sergeant wrote:
> > 
> > Sadly gmtime doesn't return any component indicating the timezone. Of
> > course why not print out GMT instead of %Z?
> 
> Because it won't always be GMT.

I'm confused. Why are you using gmtime then?

> > Alternatively, why not use Time::Object? It implements strftime without
> > the overhead of POSIX.pm, and does it in XS too.
> 
> Does it know Time Zones?

It just does strftime, so you can do what you've got below without loading
POSIX. Plus its OO so it makes more sense (IMHO).

> Here's what I've got so far. The idea is to get
> &$format_date to work correctly everywhere.
> 
> BEGIN {
>     if ($ENV{MOD_PERL}) {
>       use Apache::Util;
>       $format_date = \&Apache::Util::ht_time;
>     } else {
>       use POSIX;
>       $format_date = sub {
>           POSIX::strftime($_[1] || "%a, %d %b %Y %T %Z", $_[0] ?
>               localtime($_[0]) : gmtime);
>       };

I'm not sure I understand the correctness of this. Shouldn't it be:

gmtime($_[0] || time)

or

localtime($_[0] || time)

??

-- 
<Matt/>

    /||    ** Director and CTO **
   //||    **  AxKit.com Ltd   **  ** XML Application Serving **
  // ||    ** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // **     Personal Web Site: http://sergeant.org/     **
     \\//
     //\\
    //  \\

Reply via email to