Total time taken


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Total time taken
# 1  
Old 08-03-2012
Total time taken

Hi Friend,
Need your help.
I have a file which has information of start time and End time . I need to find how much time takes to complete the job . how can I do it in unix command .

Example of Log file :

Code:
 Start Loading                     ---Thu Aug  2 17:14:09 EDT 2012
 Load completed   successfully---Fri Aug  3 09:00:44 EDT 2012

Moderator's Comments:
Mod Comment Code tags for code, please.

Last edited by Corona688; 08-03-2012 at 01:48 PM..
# 2  
Old 08-03-2012
This may be simple on some systems and extremely difficult in others. What's your OS and shell? uname -a if you don't know.

If you have Linux, converting dates into timestamps is straightforward:

Code:
$ date +%s -d "Thu Aug  2 17:14:09 EDT 2012"

1343942049

$

...and getting the difference between two times becomes a matter of simple arithmetic.

Last edited by Corona688; 08-03-2012 at 01:54 PM..
# 3  
Old 08-07-2012
OS is AIX .
# 4  
Old 08-10-2012
We changed the code and put the following logic
Code:
START=$SECONDS
END=$SECONDS
echo elapsed time is $((END-START)) seconds

Can any one help how to convert this seconds in HH MM SS format
# 5  
Old 08-10-2012
That comes down to math.

Code:
SS=$(( (END-START) % 60 ))
MM=$(( ((END-START) / 60) % 60 ))
HH=$(( ((END-START)/(60*60))%24 ))

# 6  
Old 08-11-2012
Not sure but does AIX have the 'time' command? If so, preface your command with the time command
Code:
time <your command>

This will provide the system time, the user time and the total time.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Total size utilizes by the files older than a time span

Through find command I identified the files older that 1 year. I need the overall size utilizes by these 1 year older files. Please share me the command to identify it .Thanks Please post in an adequate technical forum! (3 Replies)
Discussion started by: Sang
3 Replies

2. Solaris

Total

i want to list Total HDD count in any soalris machine..can someone suggest some commands or combinations of commands (6 Replies)
Discussion started by: omkar.jadhav
6 Replies

3. UNIX for Dummies Questions & Answers

Dig total query time?

I'm using a .txt file filled with domain names for dig to use, the problem is that when i look at the results I get the query time for each individual query, I want to know how long it took in total for all queries to run, how can I achieve this? any help would be greatly appreciated, thank you.... (3 Replies)
Discussion started by: r7a7v7
3 Replies

4. Shell Programming and Scripting

Help with sum total number of record and total number of record problem asking

Input file SFSQW 5192.56 HNRNPK 611.486 QEQW 1202.15 ASDR 568.627 QWET 6382.11 SFSQW 4386.3 HNRNPK 100 SFSQW 500 Desired output file SFSQW 10078.86 3 QWET 6382.11 1 QEQW 1202.15 1 HNRNPK 711.49 2 ASDR 568.63 1 The way I tried: (2 Replies)
Discussion started by: patrick87
2 Replies

5. Shell Programming and Scripting

Total Time

Hello, I have one script which takes some time to complete. I Need the total exact time taken by this script. How can i modify this script. Regards, Sam. (21 Replies)
Discussion started by: j_panky
21 Replies

6. Shell Programming and Scripting

How to get total time using awk

Hi guys, I can't find a solution to sum the h:m:s: columns. 28/05/2010 03h 29min 34seg ADSL TELEMAR 28/05/2010 12h 19min 21seg ADSL TELEMAR 29/05/2010 04h 20min 02seg ADSL TELEMAR 29/05/2010 04h 31min 45seg ADSL TELEMAR 30/05/2010 06h 10min 43seg ADSL TELEMAR Thanks Use code... (8 Replies)
Discussion started by: ashimada
8 Replies

7. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

8. UNIX for Dummies Questions & Answers

du total

Hi All Can anyone help me with the following du querry. I am trying to achieve a total size for all the zipped files in a directory. Using du -k *.gz gets me a file by file list but no handy total at the bottom. Thanks Ed (9 Replies)
Discussion started by: C3000
9 Replies

9. UNIX for Dummies Questions & Answers

grep running total/ final total across multiple files

Ok, another fun hiccup in my UNIX learning curve. I am trying to count the number of occurrences of an IP address across multiple files named example.hits. I can extract the number of occurrences from the files individually but when you use grep -c with multiple files you get the output similar to... (5 Replies)
Discussion started by: MrAd
5 Replies
Login or Register to Ask a Question