From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <20140902212734.39690B827@mail.bitblocks.com> References: <346c54679a6cdc9bb557724d8b93bbc6@quintile.net> <6e2a7a02201fcf3ea5d0d894d0d16916@ladd.quanstro.net> <20140902200400.81EAAB827@mail.bitblocks.com> <20140902212734.39690B827@mail.bitblocks.com> Date: Tue, 2 Sep 2014 14:43:42 -0700 Message-ID: From: Skip Tavakkolian To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] silly question Topicbox-Message-UUID: 14f34026-ead9-11e9-9d60-3106f5b1d025 not strange; misunderstood :) On Tue, Sep 2, 2014 at 2:27 PM, Bakul Shah wrote: > Skip, You have a very strange sense of humour. > > At the first stroke it will be ten thrree & 40 seconds. > At the first stroke it will be ten thrree & 50 seconds. > At the first stroke it will be ten four. Precisely. > > On Tue, 02 Sep 2014 14:10:57 PDT Skip Tavakkolian wrote: >> inspired me to write discotime: >> >> % cat discotime.go >> // print the number of seconds from the dawn of Disco until the date >> in the argument >> package main >> >> import ( >> "fmt" >> "os" >> "time" >> ) >> >> func main() { >> for _, s := range os.Args[1:] { >> d, err := time.Parse(time.UnixDate, s) >> if err != nil { >> panic(err) >> } >> fmt.Println(d.Unix()) >> } >> } >> % ./discotime 'Tue Aug 16 17:03:52 CDT 1977' >> 240599032 >> >> to make a hammertime (http://en.wikipedia.org/wiki/U_Can't_Touch_This) >> you can subtract 1990 from parsed date instead. >> >> -Skip >> >> >> On Tue, Sep 2, 2014 at 1:04 PM, Bakul Shah wrote: >> > On Tue, 02 Sep 2014 15:10:56 EDT erik quanstrom wro >> te: >> >> > 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 incrementi >> ng >> >> > 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/c >> tim >> >> 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. >> > >> >