C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-07-2001, 12:31 PM   #1
JFK
Registered User
 
Join Date: Oct 2001
Posts: 15
Unhappy First time on the forum, need help fast!!

I have to write a programme to show the amount of elapsed time between two given times, for example, start time 14:59:59 - end time = 15:00:00. Elapsed time = 0:0:1. I know it is to do with the mod % function but the minutes are causing me problems. I'm new to this C business and would appreciate any help you kind people could give me!
JFK is offline   Reply With Quote
Old 10-07-2001, 02:01 PM   #2
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,618
Convert the times to seconds (hr*3600+min*60+sec) in order to calculate the difference.

Then use / and % to extract the difference in terms of hr, min and sec.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 10-07-2001, 02:17 PM   #3
Unregistered
Guest
 
Posts: n/a
Your just to clever Salem, I spent ages messing about with time functions and go nowhere lol.
  Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine the closest departure time Kyeong C Programming 9 10-07-2008 08:06 PM
Journey time prog 1 minute wrong mike_g C Programming 4 10-12-2006 03:41 AM
calculating user time and time elapsed Neildadon C++ Programming 0 02-10-2003 06:00 PM
time class Unregistered C++ Programming 1 12-11-2001 10:12 PM


All times are GMT -6. The time now is 09:54 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22