Timezone problems


#1

Hi,

Just installed Piwik 1.7 on a CentOS server and having problems getting it to show the correct times.

I’m living in Amsterdam, my timezone is CET (or Europe/Amsterdam, Europe/Berlin for that matter).

My shell is showing the correct time:


[admin@rick ~]$ date
Sun Feb 19 12:30:00 CET 2012

A PHP file containing


<?php
echo 'Timezone: '.date_default_timezone_get().'<br/>';
echo 'Time: '.date('H:i:s').'<br />';
?>

Outputs:


Timezone: Europe/Berlin
Time: 12:30:00

PHPinfo() states:


date/time support	enabled
"Olson" Timezone Database Version	2010.9
Timezone Database	internal
Default timezone	Europe/Berlin

All my Piwik sites are configured to use “Europe/Amsterdam” as default timezone.

The archive.php script is showing an hour earlier:


[admin@rick ~]$ date
Sun Feb 19 12:30:00 CET 2012
[admin@rick ~]$ /usr/local/bin/php piwik/misc/cron/archive.php
[2012-02-19 [b]11:30:00[/b]] [2916c537] ---------------------------
[2012-02-19 [b]11:30:00[/b]] [2916c537] INIT
(...)

To make things weirder, my Piwik stats itself are one hour ahead. ‘Visits by server time’, ‘Visitors in Real Time’ and ‘Visitor Log’ are showing visits with a time in the future.


Sun 19 Feb - [b]13:30[/b] (1 min 9s)           #2 - IP: XXXXXXX

Help! :slight_smile:


(Matthieu Aubry) #2
  1. it’s normal that archive.php is showing UTC time. This is by design, piwik always works in UTC
  2. to display times in the VIsitor log / real time widget, you have to edit your website timezone in Piwik > Settings > websites

#3

[quote=matt]

  1. it’s normal that archive.php is showing UTC time. This is by design, piwik always works in UTC

  2. to display times in the VIsitor log / real time widget, you have to edit your website timezone in Piwik > Settings > websites[/quote]

  3. Okay.

  4. All my website have “Europe/Amsterdam” set as timezone in Piwik.

Edit: I changed the Piwik timezone to UTC (what is incorrect, since my current time offset is UTC+1). However, the real time visitors time is now correct.


(Nicolas Cynober) #4

IMHO: Piwik working in UTC is one thing. Logging in UTC is another.
All other logs are using the system timezone (syslog, nginx, php, etc…). Having piwik logging in its own timezone make things difficult to debug.
I opened a ticket : Archive.php should log in the system timezone. · Issue #3029 · matomo-org/matomo · GitHub


(Oliver Lippert) #5

Would be nice to have log-output in my own timezone, not just UTC… looks like its a small hobby-programm if this can’t be defined. an seriously: piwik isn’t a small hobby-programm :slight_smile:


(Matthieu Aubry) #6

I increased priority of ticket…


#7

Two years later, any news here?


(Matthieu Aubry) #8

No, see ticket: Archive.php should log in the system timezone. · Issue #3029 · matomo-org/piwik · GitHub - we do not plan to work on this