By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,137 Members | 1,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,137 IT Pros & Developers. It's quick & easy.

Comparing two time values in order to find the lower one.

P: 2
Hi,

I need to compare some time values stored in a file in the following format & get the lowest of them.

FORMAT - 16:12.433(mins:seconds.milliseconds)

Can someone help me with the required coding.

Madhura
Dec 19 '06 #1
Share this Question
Share on Google+
1 Reply


100+
P: 145
Hi,

I need to compare some time values stored in a file in the following format & get the lowest of them.

FORMAT - 16:12.433(mins:seconds.milliseconds)

Can someone help me with the required coding.

Madhura
I'd recommend converting all these times into milliseconds:

Expand|Select|Wrap|Line Numbers
  1. int Milliseconds = (int) (seconds.milliseconds)*1000 + (int) (minutes)*60*1000;
  2. // = (int) (seconds.milliseconds + minutes*60)* 1000;
  3.  
Then, you can do standard <=, >=, and == comparisons. -- Paul
Dec 19 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.