Thread: First time on the forum, need help fast!!

  1. #1
    Registered User
    Join Date
    Oct 2001

    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!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Your just to clever Salem, I spent ages messing about with time functions and go nowhere lol.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Determine the closest departure time
    By Kyeong in forum C Programming
    Replies: 9
    Last Post: 10-07-2008, 08:06 PM
  2. Journey time prog 1 minute wrong
    By mike_g in forum C Programming
    Replies: 4
    Last Post: 10-12-2006, 03:41 AM
  3. calculating user time and time elapsed
    By Neildadon in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2003, 06:00 PM
  4. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM