Thread: 12 minute timer

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    1

    12 minute timer

    erk... ok.... well I really have no comprehension of time functions in c++

    Could someone point me towards or write an example code?

    DETAILS:

    A clock that starts at 0:00 and goes to 23:99 and then loops

    30 secs between 0:00 and 1:00 etc

    Major help

    -Gone

  2. #2
    Registered User
    Join Date
    Sep 2003
    Posts
    135
    Take a look at the time functions in the header <ctime> (or the C library header <time.h>). Using the functions available in that header, the program you need to write should be pretty straight forward. Have a go, and if you get stuck post your code here for help.

    p.s. Do you mean 23:59?

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    I would start with two ints: one to count minutes and one to count seconds.

    every second, increase the seconds and do the following:
    if (seconds > 59)
    reset seconds
    increment minutes
    else
    increment seconds

    I'll leave it up to you to use the right timing functions... try starting here: http://www.cppreference.com/stddate.html
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SIGALRM and timer
    By nkhambal in forum C Programming
    Replies: 1
    Last Post: 06-30-2008, 12:23 AM
  2. Is this me or Windows?
    By carrotcake1029 in forum C Programming
    Replies: 9
    Last Post: 05-07-2008, 09:18 AM
  3. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 06:25 PM
  4. Can't figure out why?
    By kwigibo in forum C Programming
    Replies: 10
    Last Post: 10-14-2001, 10:58 PM