First time on the forum, need help fast!!

This is a discussion on First time on the forum, need help fast!! within the C Programming forums, part of the General Programming Boards category; I have to write a programme to show the amount of elapsed time between two given times, for example, start ...

  1. #1
    JFK
    JFK is offline
    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!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Unregistered
    Guest
    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, 05:00 PM
  4. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 09:12 PM

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