From 05795f40b9bb503c8e487f06cbe431496502041f Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 4 Dec 2008 16:26:18 +0100 Subject: [PATCH] Added workaround for year detection for RFC 3164 like timestamps. This also solves rare new year conditions --- src/include/functions_common.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index c5b1252..a82d0d3 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -1071,7 +1071,15 @@ function GetEventTime($szTimStr) if ( preg_match("/(...) ([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) { // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[3], $out[4], $out[5], GetMonthFromString($out[1]), $out[2]); + $eventtime[EVTIME_TIMESTAMP] = mktime($out[3], $out[4], $out[5], GetMonthFromString($out[1]), $out[2], date("Y") ); + + // If the current time is + if ( $eventtime[EVTIME_TIMESTAMP] > time() ) + { + // rare case on new year only! + $eventtime[EVTIME_TIMESTAMP] = mktime($out[3], $out[4], $out[5], GetMonthFromString($out[1]), $out[2], date("Y")-1 ); + } + $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! $eventtime[EVTIME_MICROSECONDS] = 0;