CLF = WTF?

Jim Ault jimaultwins at yahoo.com
Sat Mar 7 16:42:46 EST 2009


Four lines, and then Ken's (better) solution in two lines

  put "10/Oct/2000:13:55:36" into dtCLF
   ----
   set the itemdel to ":"
   get (item 1 of dtCLF)
   replace slash with "/" & cr in it
   convert ((line 2 of it & line 1 of it & line 3 of it) && (item 2 to  
-1 of dtCLF)) to seconds
   ----
   put it
----------------------------------

Ken Ray in two lines
get matchText(tDate,"(.*?)/(.*?)/(.*?):(.*?)$",tDay,tMonth,tYear,tRest)
convert ((tMonth && tDay && tYear) && tRest) to seconds

Jim Ault
Las Vegas
On Mar 7, 2009, at 12:28 PM, Richard Gaskin wrote:

> I'm writing a web log analysis tool for my sites with Rev (why does  
> every hosting company's built-in log tool suck?), and after I parse  
> out the date stamp element I find it won't go through Rev's convert  
> command without throwing an error.
>
> Apache's Common Log Format (CLF) uses this form for dates:
>
>  10/Oct/2000:13:55:36 -0700
> <http://httpd.apache.org/docs/1.3/logs.html#common>
>
> This is different from Rev"s "internet date", used by many other  
> processes:
>
> Sat, 7 Mar 2009 12:20:48 -0800
>
> So my question here is twofold:
>
> 1. Why did whomever spec'd CLF invent a novel date format rather  
> than simply use a more prevelant form?  Is there a benefit to this  
> novelty that I've overlooked?  Or is it even all that novel?  Heck,  
> maybe it's used throughout a million other web processes and I've  
> just never noticed it before; it would seem strange, though, that no  
> one who's ever worked on Rev noticed it either.
>
> 2. Right now I'm parsing the CLF date and reformatting it into  
> "internet date" using about a dozen lines of code, and maybe it  
> could be simplified a bit more but what I'd ideally like is the  
> efficiency of a one-liner.  Anyone here know of a what to alter CLF  
> dates into a form that will survive Rev's "convert" command in one  
> or two lines?
>
>
> TIA -
>
> --
> Richard Gaskin
> Fourth World
> Revolution training and consulting: http://www.fourthworld.com
> Webzine for Rev developers: http://www.revjournal.com
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the Use-livecode mailing list