George Vieira <[EMAIL PROTECTED]>
> 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..
divide by 60 for minutes and 3600 for hours (but you knew
that I guess!).
eg. (only shows integer values but you get the idea)
if [ $connect_time -lt 61 ]; then
echo "connected for $connect_time seconds"
elif [ $connect_time -gt 60 -a $connect_time -lt 3601 ]; then
connect_minutes=`expr $connect_time '/' 60`
echo "connected for $connect_minutes minutes"
else
connect_hours=`expr $connect_time '/' 3600`
echo "connected for $connect_hours hours"
fi
to do H:M:S you need to get more fancy with mods and remainders
and so on (mod is "%" in sh, not sure about remainder).
Dave.
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug