• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7068: SEARCH{date="interval"} incorrectly handles DST when in GMT timezone

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine Time Normal Closed   patch 5.1.3

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

Problem Description

 %SEARCH{date=<interval>}%
does not handle the DST setting correctly when the timezone is GMT. Instead the topic's date matching is out by an hour.

Here is a demo of the relevant Perl code from the command line,

# ( cd twiki/lib && perl -I$PWD -M"TWiki::Time" -e '@a = TWiki::Time::parseInterval("2012-11-14T01:42:28/2012-11-21T02:43:00"); print "$a[0] to $a[1]\n"' )
1352853748 to 1353462180
# find twiki/data/Sandbox/LogBookNovemberEntry0001.txt -printf "%T@ %t %TZ %f\n"  
1352857348 Wed Nov 14 01:42:28 2012 GMT LogBookNovemberEntry0001.txt

The find command illustrates the correct epoch value for Wed Nov 14 01:42:28 2012 GMT which is also used in the first field of the interval passed to TWiki::Time::parseInterval(). The epoch returned by TWiki::Time::parseInterval() is 3600 seconds behind the correct value from the find comand.

Problem Analysis

The problem arises because the method used to calculate the timezone offset (from GMT) fails when the timezone is GMT. The problem is in lib/TWiki/Time.pm. Here is a demo which should return 0 but returns -3600

# perl -M"Time::Local" -e 'print &Time::Local::timelocal(0, 0, 0, 1, 0, 70),"\n"'
-3600

Problem bugfix

The attached patch fixes the problem. Here is a demo after applying this patch TWiki_Time_tzadj_patch.txt. The epoch returned is now the same as the correct value from the find command above.

( cd twiki/lib && perl -I$PWD -M"TWiki::Time" -e '@a = TWiki::Time::parseInterval("2012-11-14T01:42:28/2012-11-21T02:43:00"); print "$a[0] to $a[1]\n"' )
1352857348 to 1353465780

Tom Crane (Email: T dot Crane at rhul dot ac dot uk)

-- TWiki:Main/TomCrane - 2012-11-30

Thank you Tom for reporting a bug with patch to fix it!

This is now in SVN trunk and 5.1 branch.

-- TWiki:Main.PeterThoeny - 2012-11-30

ItemTemplate
Summary SEARCH{date="interval"} incorrectly handles DST when in GMT timezone
ReportedBy TWiki:Main.TomCrane
Codebase ~twiki4, 5.1.2, 5.1.0
SVN Range TWiki-5.1.3-trunk, Fri, 23 Nov 2012, build 24178
AppliesTo Engine
Component Time
Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:24244 TWikirev:24245
TargetRelease patch
ReleasedIn 5.1.3
Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt TWiki_Time_tzadj_patch.txt r1 manage 0.9 K 2012-11-30 - 04:38 UnknownUser bugfix patch
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r6 - 2012-12-16 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback