Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ArchiveProcessing: timezone issues #1458

Closed
robocoder opened this Issue · 29 comments

3 participants

@robocoder
Collaborator

Just started appearing now that it's currently 20:34 EST (now 00:34 UTC).

Fail: ../tests/core/ArchiveProcessing.test.php -> Test_Piwik_ArchiveProcessing -> test_init_today -> Equal expectation fails because [Integer: 1278118800] differs from [Integer: 1278117098] by 1702 at [/home/apang/work/piwik/dev/trunk/tests/core/ArchiveProcessing.test.php line 102]
Fail: ../tests/core/ArchiveProcessing.test.php -> Test_Piwik_ArchiveProcessing -> test_init_today -> Equal expectation fails because [Integer: 1278118800] differs from [Integer: 0] by 1278118800 at [/home/apang/work/piwik/dev/trunk/tests/core/ArchiveProcessing.test.php line 115]
@robocoder
Collaborator

And now at 01:04 EST (05:04 UTC), the unit tests are passing again. So there's a timezone issue here.

@robocoder
Collaborator

Rolling into #818

@robocoder
Collaborator

Re-opening as a separate issue.

@robocoder
Collaborator

Still fails but it looks like it may only be a problem between 20:00 EDT and 21:00 EDT. A bug involving daylight saving time, perhaps? I'll have to debug on another box where I can mess around with the system time...

@robocoder
Collaborator

The ArchiveProcessing tests fail when run between 8 PM and 9 PM EDT. During this hour, I presume no archiving occurs because getMinTimeArchivedProcessed() is > time().

@robocoder
Collaborator

Because this is daylight saving time, this corresponds to UTC+0 to UTC+1. In this unit test, the timezone is set to UTC-1.

@robocoder
Collaborator

(In [2694]) fixes #1458

@robocoder
Collaborator

I think the fix in [2694] might be wrong. The root problem appears to be that $this->startTimestampUTC is already for the next day (based on UTC instead of the site's timezone).

http://forum.piwik.org/index.php?showtopic=13471

@robocoder
Collaborator

(In [2926]) refs #1458 - add date test for America/Vancouver (PST/PDT)

@robocoder
Collaborator

(In [2927]) refs #1458 - cache current time so we avoid the false build failure

@jpfleury

With Piwik 0.9 for a site with 15 visits per day, I have stats only for the date range "day", so there's no data for "week", "month" and "year".

If you need access to the Piwik installation, just ask.

@robocoder
Collaborator

See also #1631

@robocoder
Collaborator

(In [3022]) refs #1458 - add conversion test

@robocoder
Collaborator

(In [3025]) refs #1458 - fix indentation

@robocoder
Collaborator

In http://forum.piwik.org/index.php?s=&showtopic=13471&view=findpost&p=61141, it appears we also have an issue with timezone adjustment in core/Controller.php.

@robocoder
Collaborator

(In [3064]) refs #1458 - fixes maxDate issue reported in http://forum.piwik.org/index.php?showtopic=13471 (this is correct in core/Controller.php)

@mattab
Owner

Anthon, would r3064 fix all problems reported in http://forum.piwik.org/index.php?showtopic=13471&st=20&start=20 ?

If so, maybe we can post patch there and ask users to try it out? thx :)

@robocoder
Collaborator

r3064, just fixes the MultiSites datepicker, so users can't select a future day.

@robocoder
Collaborator

See unit failure in http://qa.piwik.org:8080/hudson/job/Piwik/498/ -- 09/30 6:42 pm.

[exec] <hr/><span class="fail">Fail</span>: /home/www/data/root/hudson.private/jobs/Piwik/workspace/build/tests/core/ArchiveProcessing.test.php -&gt; Test_Piwik_ArchiveProcessing -&gt; test_init_currentMonth -&gt; Equal expectation fails because [Integer: 1285855200] differs from [Integer: 1285768800] by 86400 at [/home/www/data/root/hudson.private/jobs/Piwik/workspace/build/tests/core/ArchiveProcessing.test.php line 58]<br />

[exec] <span class="fail">Fail</span>: /home/www/data/root/hudson.private/jobs/Piwik/workspace/build/tests/core/ArchiveProcessing.test.php -&gt; Test_Piwik_ArchiveProcessing -&gt; test_init_currentMonth -&gt;  at [/home/www/data/root/hudson.private/jobs/Piwik/workspace/build/tests/core/ArchiveProcessing.test.php line 59]<br />
@robocoder
Collaborator

(In [3227]) refs #1458 - fix unit test failure per comment:21

@robocoder
Collaborator

Marking as fixed for now. I've tested this as much as I could (messing with my system time and inspecting the archive tables).

@robocoder
Collaborator

Hang on... I reverted the hack in [2694], and I'm getting weird results in test_init_today. I also added for Europe/Paris and America/Toronto. It looks like internally, there's a timeshifting bug back to UTC-4.

I get errors for:

  • Europe/Paris when my local system time is 18:00-19:59. (22:00-23:59 UTC)
  • America/Toronto when my local system time is 20:00-23:59. (00:00-03:59 UTC)
@robocoder
Collaborator

(In [3246]) fixes #1458, refs #1375 - fix timezone issues

@robocoder
Collaborator

appears to be broken again in trunk

@robocoder
Collaborator

Ah... [3575].

I'll attach the test script and output for your reference matt. Maybe you can fix this regression.

@robocoder
Collaborator

Attachment: Bash script. Run it from the tests/core folder. Disable ntp (or other date/time synchronization daemons).
runit.sh

@robocoder
Collaborator

Attachment: unit test results
archive.txt

@robocoder
Collaborator
@mattab
Owner

(In [3591]) Fixes #1458 Hopefully this fixes it... it should be correct this time

@robocoder robocoder added this to the Piwik 1.1 milestone
@mattab mattab was assigned by robocoder
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.