Permalink
Browse files

Removed DST calculation code, as it appears to be causing an issue wi…

…th DST calculations in the past (see JOINDIN-169). Could still cause a problem for the next DST change, though.
  • Loading branch information...
1 parent 8ea548f commit 2727c5af3071c60b34e7ecb56f7d3ffaef332b1e @magicmonkey magicmonkey committed Apr 29, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/system/application/libraries/Timezone.php
View
11 src/system/application/libraries/Timezone.php
@@ -64,17 +64,18 @@ public function getDatetimeFromUnixtime($unixtime, $timezone) {
}
$datetime->setTimezone($tz);
+/* Commented out as it appears to be causing a DST bug - see JOINDIN-169 in Jira
// How much wrong will ->format("U") be if I do it now, due to DST changes?
// Only needed until PHP Bug #51051 delivers a better method
$unix_offset1 = $tz->getOffset($datetime);
$unix_offset2 = $tz->getOffset(new DateTime());
$unix_correction = $unix_offset1 - $unix_offset2;
-
// create datetime object corrected for DST offset
$timestamp = $unixtime + $unix_correction;
-
$datetime = new DateTime("@{$timestamp}");
$datetime->setTimezone($tz);
+*/
+
return $datetime;
}
@@ -94,13 +95,17 @@ public function UnixtimeForTimeInTimezone($timezone, $year, $month, $day, $hour,
$dateObj->setDate($year, $month, $day);
$dateObj->setTime($hour, $minute, $second);
+ $unixTimestamp = $dateObj->format("U") - $unix_correction;
+
+/* Commented out as it appears to be causing a DST bug - see JOINDIN-169 in Jira
// How much wrong will ->format("U") be if I do it now, due to DST changes?
// Only needed until PHP Bug #51051 delivers a better method
$unix_offset1 = $tz->getOffset($dateObj);
$unix_offset2 = $tz->getOffset(new DateTime());
$unix_correction = $unix_offset1 - $unix_offset2;
+ $unixTimestamp = $unix_timestamp - $unix_correction;
+*/
- $unixTimestamp = $dateObj->format("U") - $unix_correction;
return $unixTimestamp;
}

0 comments on commit 2727c5a

Please sign in to comment.