Skip to content

Commit

Permalink
Going forward to timezones ever so slightly.
Browse files Browse the repository at this point in the history
  • Loading branch information
defacer committed Mar 23, 2005
1 parent deab60a commit 0bd7322
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/moodlelib.php
Expand Up @@ -855,7 +855,7 @@ function get_user_timezone($tz = 99) {
return $tz;
}

function get_user_dst_preset() {
function get_user_timezone_preset() {
global $CFG, $USER;
static $preset = NULL;

Expand Down Expand Up @@ -1006,19 +1006,19 @@ function dst_changes_for_year($year, $dstpreset) {

// $time must NOT be compensated at all, it has to be a pure timestamp
function dst_offset_on($time) {
$preset = get_user_dst_preset();
$preset = get_user_timezone_preset();

if(empty($preset)) {
return 0;
}

if(empty($USER) || empty($USER->dstchanges)) {
if(empty($USER) || empty($USER->dstoffsets)) {
return 0;
}

$finaloffset = NULL;

foreach($USER->dstchanges as $from => $offset) {
foreach($USER->dstoffsets as $from => $offset) {
if($from <= $time) {
$finaloffset = $offset;
break;
Expand All @@ -1027,6 +1027,7 @@ function dst_offset_on($time) {

if($finaloffset === NULL) {
// This means we haven't calculated far enough ahead, do it now?
print_object($USER->dstoffsets);
error('Error in calculating DST offset for timestamp '.$time);
}

Expand Down

0 comments on commit 0bd7322

Please sign in to comment.