On Sat, 21 Oct 2006, Levi Bard wrote:
>> Getting the start time is straightforward -- use "ps -o lstart $dd_pid".
>> Fine, convert it to seconds with "date -d blahblah +%s", add it to the
>> offset, but then what? How do I convert it back?
>
> Something like:
> --
> #!/bin/sh
> HOURS=`expr $1 / 3600`
> MINUTES=`echo "($1 % 3600) / 60" | bc`
> SECONDS=`echo "($1 % 60)" | bc`
>
> printf "%02d:%02d:%02d" $HOURS $MINUTES $SECONDS
Ah, brute force then? I was hoping there was a simpler way.
How about this?
#include "date_abuse.h"
eben@pc:~$ DS=1234567890 # date in seconds-since-1/1/1970-midnight
eben@pc:~$ date -d "1/1/1970 0:0:$DS"
Fri Feb 13 23:31:30 EST 2009
I suppose I could skip DS altogether...
-- -eben QebWenE01R@vTerYizUonI.nOetP royalty.no-ip.org:81 > A: It's annoying as hell > Q: Why do most people hate top-posting? -- Lots42 The Library Avenger http://www.fscked.co.uk/writing/top-posting-cuss.html ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:20:28 EDT