You are here: Foswiki>Tasks Web>Item895 (13 Jun 2014, MichaelDaum)Edit Attach

Item895: formatTime defaults to GMT

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release:
Applies To: Engine
Component:
Branches:
Reported By: CrawfordCurrie
Waiting For:
Last Change By: MichaelDaum
Foswiki::Time::formatTime defaults to GMT if no time zone is specified. This is at odds with the configure option $Foswiki::cfg{DisplayTimeValues}

IMHO the spec of Foswiki::Time::formatTime should be changed.

-- CrawfordCurrie - 29 Jan 2009

concur.

-- SvenDowideit - 08 Feb 2009

We are already fighting with mysterious conversions happening in plugins. And it is often us living the to east of Greenwich that see the trouble.

The best is that time in is in same time zone as time out - unless you explicitly ask for a conversion to take place.

If someone touches this, please make sure you test the code in server setups both east and west of Greenwich. When you live in GMT land you miss these problems.

-- KennethLavrsen - 16 Jun 2009

Agreed. And as such, it would be best if someone outside GMT/BST addressed it, as I always seem to get it wrong.

-- CrawfordCurrie - 17 Jun 2009

This one http://irclogs.foswiki.org/bin/irclogger_log/foswiki?date=2014-06-13,Fri&sel=6#l2popped up on irc again. However I am struggling to understand above comments: formatTime does default to {DisplayTimeValues} ... as long as the output format isn't containing http.

So basically is in the response of the caller to specify which output he want's to have and which timezone it should be converted to.

-- MichaelDaum - 13 Jun 2014

The problem here is that Foswiki internally runs on GMT. The logger explicitly logs in "gmtime" regardless of the display settings.

    my $now  = _time();
    _rotate( $LEVEL2LOG{$level}, $log, $now );
    my $time = Foswiki::Time::formatTime( $now, 'iso', 'gmtime' );

So I read the IRC request is asking that the internal representation of now() be modified. I think we are asking for trouble if logging, .changes, topic timestamps, etc. get into localtime.

Actually in thinking about this, the native logging format probably ought to use the native time() timestamp and not do display time conversion. Certainly more efficient during log processing to not have to convert back to internal formats for time comparisons. Well.... maybe not.

Looking at "What does Apache do"... It logs in server time. ex: [13/Jun/2014:10:57:56 -0400]. And /var/log/messages, also logs in server time. I run my systems on GMT. So Foswiki is actually the oddball here. It's the only log on my system that isn't logged in servertime.

In any event, this is not an example of the wrong default in Foswiki::Time::formatTime(), and this task is hijacked here. We need a separate task to address log timestamp format, the logging is explicit requesting gmtime.

Opened Item12942 to address

-- GeorgeClark - 13 Jun 2014

In that case I think we can switch this one to no-action.

-- MichaelDaum - 13 Jun 2014
 

ItemTemplate edit

Summary formatTime defaults to GMT
ReportedBy CrawfordCurrie
Codebase
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Engine
Component
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
Release01x01Checkins
Topic revision: r7 - 13 Jun 2014, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy