LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 03-25-2011, 08:39 AM   #1
xeon123
Member
 
Registered: Sep 2006
Posts: 374

Rep: Reputation: 16
average of unix time stamps


Hi,

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:

Code:
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?

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

Rep: Reputation: 3
Hi,

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.

http://www.answers.com/topic/weighted-mean

[]'s

Rafa
Linux, Linux and Linux! Suporte Linux
 
Old 03-25-2011, 08:49 AM   #3
xeon123
Member
 
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 08:54 AM.
 
  


Reply



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 07:53 PM
Time Stamps for command history? WingnutOne Linux - Newbie 3 09-11-2007 08:53 AM
Time stamps following move to British Summer Time aikempshall Linux - General 2 03-30-2007 08:30 AM
Time Stamps Duplication indiancosmonaut Solaris / OpenSolaris 4 02-28-2007 10:30 AM
Samba time-stamps files incorectly k41184 Linux - Software 1 10-02-2005 08:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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