src/lib/apacheLog.c 1.3
1.3 2009/08/27 20:52:01 kent
Adding more time parsing.
Index: src/lib/apacheLog.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/apacheLog.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -B -U 4 -r1.2 -r1.3
--- src/lib/apacheLog.c 27 Aug 2009 03:54:39 -0000 1.2
+++ src/lib/apacheLog.c 27 Aug 2009 20:52:01 -0000 1.3
@@ -73,8 +73,10 @@
{
shortLine(&ll, line, fileName, lineIx);
return NULL;
}
+
+/* Parse out bracket enclosed timeStamp and time zone. */
s = strchr(buf, '[');
if (s == NULL)
{
badTimeStamp(&ll, line, fileName, lineIx);
@@ -94,8 +96,14 @@
badTimeStamp(&ll, line, fileName, lineIx);
return NULL;
}
ll->timeZone = nextWord(&s);
+
+/* Convert time stamp to Unix tick. */
+struct tm tm;
+if (strptime(ll->timeStamp, "%d/%b/%Y:%T", &tm) != NULL)
+ ll->tick = mktime(&tm);
+
buf = e+2;
if (buf[0] != '"')
{
badFormat(&ll, line, fileName, lineIx, "Missing quote after time stamp");