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

> Matt Sergeant wrote:
> > 
> > On Mon, 16 Oct 2000, David E. Wheeler wrote:
> > 
> > I'm confused. Why are you using gmtime then?
> 
> Because if no time is supplied, I want it to default to GMT. I'm setting
> up an app in which the database will store date/time in GMT only, but
> will serve it out to users in their own local timezones. So sometimes
> it'll be GMT and sometimes it won't.

Gotcha.

> BEGIN {
>     if ($ENV{MOD_PERL}) {
>       use Apache::Util;
>       $format_date = \&Apache::Util::ht_time;
>     } else {
>       use POSIX;
>       $format_date = sub {
>           POSIX::strftime($_[1] || $_[0] ? "%a, %d %b %Y %T %Z" :
>                           "%a, %d %b %Y %T GMT", $_[0] ? localtime($_[0]) :
>                           (gmtime)[0..7]);
>       };
>     }
> }

You should still switch to Time::Object. Loading POSIX.pm still loads in
the .so which contains loads of cruft for things you don't
want/need. Whereas loading Time::Object is a lot smaller. Of course I'm
not sure how you'd fix the isdst thing with Time::Object, since it does
strftime internally...

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