12 minute timer

This is a discussion on 12 minute timer within the C++ Programming forums, part of the General Programming Boards category; erk... ok.... well I really have no comprehension of time functions in c++ Could someone point me towards or write ...

  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, 01:23 AM
  2. Is this me or Windows?
    By carrotcake1029 in forum C Programming
    Replies: 9
    Last Post: 05-07-2008, 10:18 AM
  3. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 07:25 PM
  4. Can't figure out why?
    By kwigibo in forum C Programming
    Replies: 10
    Last Post: 10-14-2001, 11:58 PM

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