[ale] converting time formats in script

David S. Jackson dsj at sylvester.dsj.net
Wed Aug 15 13:36:28 EDT 2001


How would you convert a variable stored in UTC Epoch time back to
your particular time zone?

Example:  
 =-=-=-=- snip -=-=-=-=-=
#!/bin/sh
now=`date +%s`

#as long as x is true, do this loop
while [ x ]; do
  echo "I'm waiting for a change in condition"
done

# now the condition has changed and I get on with life
then=`date +%s`


dif=$(($then-$now))

echo $dif

 =-=-=-=-=-= snip -=-=-=-=-=-=

How do you express "$dif" in regular format, like date +%H:%M:%S?   
Can you convert it on the fly somehow?

TIA!

--
David S. Jackson                        dsj at dsj.net
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
A black cat crossing your path signifies that the
animal is going somewhere.  -- Groucho Marx
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.





More information about the Ale mailing list