Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-25-2011, 09:39 AM   #1
Registered: Sep 2006
Posts: 374

Rep: Reputation: 16
average of unix time stamps


I've these 2 UNIX timestamps values taken from the java method System.currentTimeMillis(). These 2 timestamps correspond to the start time and the end time of 2 process that ran. Here are the values:

starttime  ----------------    endtime
1301005328042   ----------- 1301005352079
1301005460357   ----------- 1301005484394
Now I would like to take an average of the duration that both tasks took. I was thing to do : (allendtime-allstarttimes)/2, but I think it's incorrect.

How can I take an average from UNIX timestamps?

Old 03-25-2011, 09:45 AM   #2
LQ Newbie
Registered: Feb 2011
Posts: 27

Rep: Reputation: 3

You can get a simple average doing that (allendtime-allstarttimes)/2.

But you can get very best average, with some more samples (you have only 2).

Take a look at this method (you can apply on your problem), but you must have more samples.


Linux, Linux and Linux! Suporte Linux
Old 03-25-2011, 09:49 AM   #3
Registered: Sep 2006
Posts: 374

Original Poster
Rep: Reputation: 16
1- I've more numbers, of course. I just want to know from my timestamps if I can get an answer, for examples, that says to me that the average from these timestamps is 5 seconds.

I've the preference to do the average in bash, despite the values are taken from a java method.

2 - Thanks rafatmb of suggestion of the average mean, but I this it's not good for my case, because I can't take a weighted mean from time stamps that are totally different.

Last edited by xeon123; 03-25-2011 at 09:54 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] add time stamps to files VickIsSlick Linux - Newbie 5 12-16-2010 08:53 PM
Time Stamps for command history? WingnutOne Linux - Newbie 3 09-11-2007 09:53 AM
Time stamps following move to British Summer Time aikempshall Linux - General 2 03-30-2007 09:30 AM
Time Stamps Duplication indiancosmonaut Solaris / OpenSolaris 4 02-28-2007 11:30 AM
Samba time-stamps files incorectly k41184 Linux - Software 1 10-02-2005 09:24 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:59 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration