On Tue, 02 Sep 2014 15:10:56 EDT erik quanstrom <[email protected]> wrote: > > Strftime is a red herring (sorry), I can use and "date" | getline > > to generate pretty much any date string I need. > > > > The issue is more going the other way. tm2sec in awk is quite complex > > and hids many pitfalls if you want to do it correctly. > > > > My problem is parsing logfiles which contain dates in the form > > of date(1) / ctime(2). > > > > I want to graph stuff over time and so I want a monotonically incrementing > > number (secs sinc 1/1/70 would be ideal). I have coded this in awk but > > for one year leap years break - though not by much. > > if the hair is just leap years, the algorithm used by /sys/src/libc/9sys/ctim > e.c > is pretty attractive. the idea is to just loop through the years between giv > en > and 1970, and add a day for each leap year encountered. should be easy > to do in awk.
plan9 doesn't deal with leap seconds, right? There've been 35 leap seconds since 1972 (International Atomic Time is 35 seconds ahead of GMT). Though this probably doesn't matter for timestamps in log files.
