Skip to content

Commit

Permalink
fixed default time zone handling when date.timezone not set in php
Browse files Browse the repository at this point in the history
Previous behavior was to force the timezone to be America/Los_Angeles
when none was set.  This caused issues because the data
in the table didn't agree with the offsets in the interface
and you would get incorrect query results

Now the default is to use the system timezone, which produces
more reasonable results.
  • Loading branch information
gtowey committed Aug 18, 2014
1 parent e0c4310 commit ed70381
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Anemometer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ function __construct($conf)
$timezone = ini_get('date.timezone');
if (!$timezone)
{
date_default_timezone_set('America/Los_Angeles');
$system_timezone = exec('date +%Z');
date_default_timezone_set($system_timezone);
$timezone = date_default_timezone_get();
}
$this->timezone_offset = timezone_offset_get( new DateTimeZone( $timezone ), new DateTime());
Expand Down

0 comments on commit ed70381

Please sign in to comment.