On Wed, 06 Sep 2000, George Vieira generated:

>Hi all,
>
>I have PPPD running and sending out via $CONNECT_TIME variable the time the
>link was up for. The problem is that it's in seconds only and I get rsults
>like "37646752 seconds". Is there a way to convert this into H:M:S?
>
>I am doing this in a bash script..

Something like:

HOURS=`expr $CONNECT_TIME \/ 3600`
CONNECT_TIME=`expr $CONNECT_TIME - \( $HOURS \* 3600 \)`
MINUTES=`expr $CONNECT_TIME \/ 60`
CONNECT_TIME=`expr $CONNECT_TIME = \( $MINUTES \* 60 \)`
SECONDS=$CONNECT_TIME

Erk, ugly.

I looked at the manpage for date, with the intention of doing something
like date -d 00000000.$CONNECT_TIME +%r but it didn't like the date that
way, i guess it needs the seconds between 0 and 59.  Also, there was
nothing about converting unix time to normal time.  I'm convinced there
must be a tool to do this.

-- 
jamesw

"I have frog fear."
                -- Willow Rosenberg, Buffy the Vampire Slayer
------------------------------
[EMAIL PROTECTED]


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to