Revision: 2462
https://sourceforge.net/p/mrbs/code/2462/
Author: cimorrison
Date: 2012-10-03 14:11:37 +0000 (Wed, 03 Oct 2012)
Log Message:
-----------
Fixed bug causing invalid time slots not to be displayed properly when the
booking day was contained within the DST transition times (eg 0100-0200)
Modified Paths:
--------------
mrbs/branches/flexible_day_end/web/functions.inc
mrbs/branches/flexible_day_end/web/functions_table.inc
Modified: mrbs/branches/flexible_day_end/web/functions.inc
===================================================================
--- mrbs/branches/flexible_day_end/web/functions.inc 2012-10-03 13:33:02 UTC
(rev 2461)
+++ mrbs/branches/flexible_day_end/web/functions.inc 2012-10-03 14:11:37 UTC
(rev 2462)
@@ -1447,9 +1447,21 @@
}
+// Determines whether there's a possibility that the interval between the two
Unix
+// timestamps could contain nominal times that don't exist, for example from
0100 to
+// 0159 in Europe/London when entering DST.
+function is_possibly_invalid($start, $end)
+{
+ // We err on the side of caution by widening the interval by a day at each
end. This
+ // allows for the possibility that the start or end times have been
calculated by using
+ // mktime() on an invalid time!
+ return (cross_dst($start - 86400, $end + 86400) < 0);
+}
+
+
// Checks whether the nominal time given is an invalid date and time with
respect to
// DST transitions. When entering DST there is a set of times that don't
exist, for
-// example from 0200 to 0259 in Europe/London.
+// example from 0100 to 0159 in Europe/London.
// Returns NULL if MRBS is unable to determine an answer, otherwise TRUE or
FALSE (so
// a simple equality test will default to a valid time if MRBS can't determine
an answer)
function is_invalid_datetime($hour, $minute, $second, $month, $day, $year,
$tz=NULL)
Modified: mrbs/branches/flexible_day_end/web/functions_table.inc
===================================================================
--- mrbs/branches/flexible_day_end/web/functions_table.inc 2012-10-03
13:33:02 UTC (rev 2461)
+++ mrbs/branches/flexible_day_end/web/functions_table.inc 2012-10-03
14:11:37 UTC (rev 2462)
@@ -735,7 +735,7 @@
// If we know that there's a transition into DST then some of the slots are
// going to be invalid. Knowing whether or not there are possibly invalid
slots
// saves us bothering to do the detailed calculations of which slots are
invalid.
- $is_possibly_invalid = !$enable_periods && cross_dst($am7, $pm7) < 0;
+ $is_possibly_invalid = !$enable_periods && is_possibly_invalid($am7, $pm7);
// We want to build an array containing all the data we want to show
// and then spit it out.
@@ -1048,7 +1048,7 @@
// If we know that there's a transition into DST then some of the slots are
// going to be invalid. Knowing whether or not there are possibly
invalid slots
// saves us bothering to do the detailed calculations of which slots are
invalid.
- $is_possibly_invalid[$j] = !$enable_periods && cross_dst($am7[$j],
$pm7[$j]) < 0;
+ $is_possibly_invalid[$j] = !$enable_periods &&
is_possibly_invalid($am7[$j], $pm7[$j]);
}
unset($j); // Just so that we pick up any accidental attempt to use it later
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits