[sf-lug] unix time: translate to/from human readable ('understandable') form?
Michael Paoli
Michael.Paoli at cal.berkeley.edu
Mon Feb 16 10:20:43 PST 2009
> Date: Sun, 15 Feb 2009 08:29:40 -0800 (PST)
> From: Alex Kleider <a_kleider at yahoo.com>
>
> My logwatch program frequently reports the following (number of
> entries varies:)
> --------------------- Kernel Begin ------------------------
> 1 Time(s): [4722550.276000] r8169: eth0: link down
> 1 Time(s): [4724883.976000] r8169: eth0: link up
> 1 Time(s): [4724901.352000] r8169: eth0: link down
> 1 Time(s): [4724902.988000] r8169: eth0: link up
> 1 Time(s): [4724905.644000] r8169: eth0: link down
> 1 Time(s): [4724907.444000] r8169: eth0: link up
> ---------------------- Kernel End -------------------------
>
> A second part to my question, directed mainly to the ThinkPython group:
> the numbers in square brackets I assume represent 'unix time' and if
> so, is there a Python module that can help me make use of this: i.e.
> translate back and forth to/from human readable (read
> 'understandable') form?
Those don't look to be 'unix time'[1] format ... particularly easy to
note/recognize, since we quite recently passed[2]
1234567890.
Conversions, ... I'd typically grab perl(1) ...
been there, done that[3] ...
or use some of the capabilities of GNU's date(1)[4],
... or perhaps in C if I was really going to be pounding
away at it. There's also likely a Python answer
somewhere back on that earlier thread[5].
references/excerpts:
1. http://en.wikipedia.org/wiki/Unix_time
2. http://www.1234567890day.com/
3. http://linuxmafia.com/pipermail/sf-lug/2008q4/005814.html
4. http://www.gnu.org/software/coreutils/manual/html_node/date-invocation.html
5. :
http://linuxmafia.com/pipermail/sf-lug/2008q4/date.html
http://linuxmafia.com/pipermail/sf-lug/2008q4/005749.html
et. seq.
More information about the sf-lug
mailing list