File: parseLine.php

package info (click to toggle)
simplesamlphp 1.14.11-1%2Bdeb9u2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 15,024 kB
  • sloc: php: 72,337; xml: 1,078; python: 376; sh: 220; perl: 185; makefile: 57
file content (24 lines) | stat: -rw-r--r-- 856 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
class sspmod_logpeek_Syslog_parseLine{
	
	
	public static function isOlderThan($time, $logLine){
		return true;
	}
	
	public static function getUnixTime($logLine, $year = NULL){
		// I can read month and day and time from the file.
		// but I will assum year is current year retured by time().
		// Unless month and day in the file is bigger than current month and day,
		// I will then asume prevous year.
		// A better approach would be to get the year from last modification time (mtime) of the
		// file this record is taken from. But that require knowledge about the file.
		if(!$year){
			$now = getdate();
			$year = (int)$now['year'];
		}
		list($month, $day, $hour, $minute, $second) = sscanf($logLine, "%s %d %d:%d:%d ");
		$time = sprintf("%d %s %d %d:%d:%d", $day, $month, $year, $hour, $minute, $second);
		return strtotime($time);
	}
}