Permalink
Browse files

Merged DST-related fixes from HEAD.

  • Loading branch information...
1 parent cd47b25 commit d32ae936e4507738ea3cede6d5f21c4bb8db03b7 defacer committed Nov 20, 2004
Showing with 6 additions and 3 deletions.
  1. +5 −2 calendar/lib.php
  2. +1 −1 calendar/view.php
View
7 calendar/lib.php
@@ -290,6 +290,9 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
// This effectively adds as many days as needed, and the final SECS_IN_DAY - 1
// serves to cover the duration until the end of the final day. We could
// just do another gmmktime() and an addition, but this is "faster" :)
+
+ // WARNING: IT IS ALSO BUGGY WITH REGARDS TO DST CHANGES! THIS HAS TO BE FIXED SOMEDAY!
+ // IF YOU DO SECS ARITHMETIC, THE CODE WILL ALWAYS BE BUGGY WITH REGARD TO DST!
$display->tend = $display->tstart + (SECS_IN_DAY * $display->range) - 1;
// Get the events matching our criteria
@@ -537,8 +540,8 @@ function calendar_top_controls($type, $data) {
case 'day':
$data['d'] = $date['mday']; // Just for convenience
$dayname = calendar_wday_name($date['weekday']);
- $prevdate = getdate($time - SECS_IN_DAY);
- $nextdate = getdate($time + SECS_IN_DAY);
+ $prevdate = getdate(make_timestamp($data['y'], $data['m'], $data['d'] - 1));
+ $nextdate = getdate(make_timestamp($data['y'], $data['m'], $data['d'] + 1));
$prevname = calendar_wday_name($prevdate['weekday']);
$nextname = calendar_wday_name($nextdate['weekday']);
$content .= "<table style='width: 100%;'><tr>\n";
View
2 calendar/view.php
@@ -193,7 +193,7 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) {
$getvars = 'from=day&amp;cal_d='.$d.'&amp;cal_m='.$m.'&amp;cal_y='.$y; // For filtering
$starttime = make_timestamp($y, $m, $d);
- $endtime = $starttime + SECS_IN_DAY - 1;
+ $endtime = make_timestamp($y, $m, $d + 1) - 1;
$events = calendar_get_upcoming($courses, $groups, $users, 1, 100, $starttime);

0 comments on commit d32ae93

Please sign in to comment.