Revision: 2280
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2280&view=rev
Author:   cimorrison
Date:     2012-04-04 15:57:55 +0000 (Wed, 04 Apr 2012)
Log Message:
-----------
Fixed bug where resized bookings jump by one hour on the DST start and end 
days.   Thanks to Henry S. Thompson

Modified Paths:
--------------
    mrbs/trunk/web/edit_entry_handler.php

Modified: mrbs/trunk/web/edit_entry_handler.php
===================================================================
--- mrbs/trunk/web/edit_entry_handler.php       2012-04-04 15:35:28 UTC (rev 
2279)
+++ mrbs/trunk/web/edit_entry_handler.php       2012-04-04 15:57:55 UTC (rev 
2280)
@@ -148,19 +148,28 @@
         case 'confirmed':
           $$var = !($old_booking['status'] & STATUS_TENTATIVE);
           break;
+        // In the calculation of $start_seconds and $end_seconds below we need 
to take
+        // care of the case when 0000 on the day in question is across a DST 
boundary
+        // from the current time, ie the days on which DST starts and ends.
         case 'start_seconds';
           $date = getdate($old_booking['start_time']);
           $start_year = $date['year'];
           $start_month = $date['mon'];
           $start_day = $date['mday'];
-          $start_seconds = $old_booking['start_time'] - mktime(0, 0, 0, 
$start_month, $start_day, $start_year);
+          $start_daystart = mktime(0, 0, 0, $start_month, $start_day, 
$start_year);
+          $old_start = $old_booking['start_time'];
+          $start_seconds = $old_start - $start_daystart;
+          $start_seconds -= cross_dst($start_daystart, $old_start);
           break;
         case 'end_seconds';
           $date = getdate($old_booking['end_time']);
           $end_year = $date['year'];
           $end_month = $date['mon'];
           $end_day = $date['mday'];
-          $end_seconds = $old_booking['end_time'] - mktime(0, 0, 0, 
$end_month, $end_day, $end_year);
+          $end_daystart = mktime(0, 0, 0, $end_month, $end_day, $end_year);
+          $old_end = $old_booking['end_time'];
+          $end_seconds = $old_end - $end_daystart;
+          $end_seconds -= cross_dst($end_daystart, $old_end);
           break;
         default:
           if (array_key_exists($var, $old_booking))

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to