mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 03:09:21 +02:00
Added workaround for year detection for RFC 3164 like timestamps. This also solves rare new year conditions
This commit is contained in:
parent
673b1863df
commit
05795f40b9
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user