LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   computing time duration (https://www.linuxquestions.org/questions/linux-general-1/computing-time-duration-638669/)

tmaxx 04-29-2008 10:14 AM

computing time duration
 
hi can anyone help on a script which computes time duration:

given:

a. database archive update time = 15:25
b. current system = 17:15

b-a=duration

thanks in advance

chrism01 04-29-2008 08:37 PM

This should really be in the prog forum.

You could write a script in bash, eg cvt hrs to mins, calc total time, then subtract results in mins.
To get hrs

echo "17:15"|cut -d':' -f1
17
mins=$((17 * 60))
1020

etc

Get started and come back to us if you get stuck.
Here's a some good refs:
http://www.tldp.org/LDP/abs/html/
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://rute.2038bug.com/index.html.gz


All times are GMT -5. The time now is 07:43 PM.