Tags:
create new tag
, view all tags

Question

I found that SpreadSheetPlugin makes an error while calculating the number of seconds between 03 Nov 2008 and 02 Nov 2008. - It gives an answer of 90000 instead of 86400

Number of seconds between 02 Oct 2008 and 01 Oct 2008 = %CALC{"$EVAL($TIME(02 Oct 2008) - $TIME(01 Oct 2008))"}% = 86400

Number of seconds between 03 Oct 2008 and 02 Oct 2008 = %CALC{"$EVAL($TIME(03 Oct 2008) - $TIME(02 Oct 2008))"}% = 86400

Number of seconds between 02 Nov 2008 and 01 Nov 2008 = %CALC{"$EVAL($TIME(02 Nov 2008) - $TIME(01 Nov 2008))"}% = 86400

Number of seconds between 03 Nov 2008 and 02 Nov 2008 = %CALC{"$EVAL($TIME(03 Nov 2008) - $TIME(02 Nov 2008))"}% = 90000

Number of seconds between 04 Nov 2008 and 03 Nov 2008 = %CALC{"$EVAL($TIME(04 Nov 2008) - $TIME(03 Nov 2008))"}% = 86400

Funnily, this doesn't happen on my test Twiki installation on my laptop (WinXP)

What could be the reason ? Is this a bug ?

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Windows 2003
Web server: Apache 1.3.39
Perl version: 5.008008 (cygwin)
Client OS: Windows XP
Web Browser: IE 6
Categories: Plugins

-- ChengappaCB - 24 Nov 2008

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

This looks like a bug to me. It's unlikely the $EVAL, although you could manually check the difference to find out. I suspect $TIME, which calls the Perl function timelocal() to convert from display time to serial time. You can test that:

my $t2 = timelocal(0, 0, 0, 2, 10, 2008);
my $t3 = timelocal(0, 0, 0, 3, 10, 2008);
print $t3 - $t2;

The difference is 3600, e.g. exactly one hour. This could point to a daylight savings change, but your example is Nov, e.g. not a time for change.

I'd check with Perl.

-- PeterThoeny - 24 Nov 2008

November 2nd was indeed the day for Daylight savings in 2008, so 90000 seconds is the correct amount of time

-- TimHeilig - 24 Nov 2008

Glad it worked out!

-- PeterThoeny - 25 Nov 2008

 
Change status to:
Topic revision: r4 - 2008-11-25 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.