I've got quit some problems with the different timestamps.
My current configuration in local.php:
<?php
date_default_timezone_set('Europe/Stockholm');
?>
I've changed the date output just to check which timezone is actually used (0 means no DST):
Photo information:
Captured: 2010-Jan-07 13:46:44 America/Los_Angeles 0
Comments:
on 2011-Jan-27 11:42:53 America/Los_Angeles 0, Gallery Administrator said
The Gallery website shows the correct time for pictures taken during the winter, but is an hour of for those taken during the summer. For example:
Captured: 2010-Apr-01 12:34:37 America/Los_Angeles 1 (11.34 according to exif)
This also gives problems when trying to use the REST interface. My wordpress uses the correct timezone so then the time is several hours off... I tried to force wordpress to America/Los_Angeles timezone and then I got the same values as in the gallery website (include the problem for pictures taken during summer).
I guess that using the correct timezone should solve some of the issues on the REST interface. But how do I fix that?
Any ideas how do to solve the issues with DST?
/Mingan
Posts: 15
I have the same Problem. After updating to version 3.0.1 the Time is wrong. Normally at germany it is now 09:00 but the gallery shows 00:00.
Posts: 7
I tried to upgrade to Gallery3.0.1. This did not solve the problem
Still the timezone shows America/Los_Angeles and the capture date of pictures taken during the summer months are still an hour of...
Can nobody help me with this issue? I can add more information if needed, just tell me what you need.
/Mingan
Posts: 7
bump
Posts: 16503
Try removing the php.ini that ships with G3
____________________________________________
Like Gallery? Like the support? Donate now!
Posts: 7
I've finally succeeded to solve the timezone issue on my system. After looking through the code I found the following:
In file modules/gallery/config/locale.php:
Why is gallery only looking at the date.timezone parameter? Why not using the date_default_timezone_get function which will check several other parameters as well? If no timezone setting is found by this function, it will return UTC which I think makes much more sense then using "America/Los_Angeles".
Anyway some information for others running in the same problem:
- you can check the timezone used by gallery by changing the date format settings (admin->setting->advance):
gallery date_time_format: Y-M-d H:i:s e I (e to include timezone, I to include DST (0 not active, 1 active))
- you can change the timezone used by gallery by creating a local.php in the gallery root containing the following lines:
As for the DST issue, after extensive google-ing I think I've located the problem to be in vista. After checking my picture software, gallery3 and even with the windows photo gallery (info option), they all showed the same time, but windows still show one hour of during summer months...
I hope the gallery designers can comment on the timezone configuration I mentioned above?
/Mingan
Posts: 16503
Did you try removing the php.ini that ships with G3?
See /modules/gallery/config/locale.php
The comments there explain why it was set to that.
____________________________________________
Like Gallery? Like the support? Donate now!
Posts: 7
Yes I tried to remove the php.ini and my local.php and once again timezone is America/Los Angeles. I also looked in the php.ini and it doesn't have any timezone configuration in it.
I know it states in the file you mention that it needs a timezone configuration, but I'm still wondering why the date_default_timezone_get function isn't used. When googling for the problem I found that gallery uses the timezone of the server, but it doesn't... All other php scripts I use, use the server timezone without any changes needed.
Or why not make it easier to change the variable? I started out looking at the obvious places, but couldn't find any configuration. Instead the default timezone is hardcoded in a subdirectory somewhere... It would have been easier to find if the default configuration was placed in for example php.ini.
Just wondering...
Posts: 7985
Looks like we took two shots at this:
https://github.com/gallery/gallery3/commit/dad537effedc51d7544e32a1b7b0ca70896d43af
https://github.com/gallery/gallery3/commit/4cd5c4cebbe80f90dd781336f9206be10113575b
Looks like we were getting issues on some systems when the timezone id was unset, so we went with an alternate approach of using the value that's defined for PHP. Any thoughts on a better approach here?
---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!
Posts: 7
I can actually see several working solutions. It depends a lot on which fits into the gallery way of thinking.
--- Configurable:
Make it configurable from the admin section (for example in the advance settings). You could do the same as now, but instead of only setting the variable runtime, you could save it as an advanced setting. Then it's easier to find and change for those that are not happy with the default settings.
--- Use date_default_timezone_get function
Greater chance of finding a valid value since it checks in more places. It checks for example both the value of date_default_timezone_set() and value of the date.timezone ini option. If no valid option is found, it returns UTC, so you should always get a valid timezone. See the php-manual: date_default_timezone_get.
--- Add the issue to the FAQ
Information on the possible problem and the solution (adding a config.php in the root of gallery with the correct setting, see my previous post). It should be one of the first places people look at when they run into a problem.
I would propose to use a combination of the first two options. Change to the date_default_timezone_get function the first time and then add the result to the configuration. This will ensure there is a valid timezone configured and it will be easy to change the timezone when needed.
Posts: 7985
Seems reasonable. I've created a ticket for this against 3.0.2: https://sourceforge.net/apps/trac/gallery/ticket/1637
---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!