Around the Clock. Hour function ??

This is a discussion on Around the Clock. Hour function ?? within the C Programming forums, part of the General Programming Boards category; Hi I'm trying to make a program, which can calculate in minuts and hours. If I have the time 1140 ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    64

    Around the Clock. Hour function ??

    Hi I'm trying to make a program, which can calculate in minuts and hours.
    If I have the time 1140 and add 40 min. so It should tell me that the time = 1220, and not 1180.

    Dows anyone have a good idea how to make this work properly.

    Tx
    !G!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,499
    > If I have the time 1140
    Split hours and minutes and calculate the time in minutes only

    m = 11 * 60 + 40

    Then add 40 to it

    Then convert back to hr:mm like so
    hr = m / 60;
    min= m % 60;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. clock program
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 10:12 PM
  2. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  4. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 12:03 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 06:05 PM

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