   A C++ Timer?
  Right now I'm designing a text-base console game. One thing that I need is a Timer.So say you ask the user to solve and enter the solution to this equation: (2 * 3) + 5. But, the user only has 7 seconds to answer it. If he/she gets it in 5 seconds, he/she wins. If it takes more than 7 seconds, he/she looses. What I want to know, is how would you make that happen. Is there a function in C++ that I could use (haven't found or heard of one at this point)? Do I create my own function to make it happen (if so, how? Where would I start)?Anyway, if anyone could provide any insight or ideas, I would appriciate it. Thanks.   
  on unix, you can use 'time()' if you don't need sub-second precisionon windows, you can use 'timeGetTime()'   ;  The standard clock() function can be used for sub-second precision timing.   ;  If you are using a windows OS then you can use GetTickCount() which increments every millisecond. It is really convienient :);  I think this will help you.timer.h#ifndef _TIMER_#define _TIMER_#include <ctime>class Timer {    clock_t counter;public:    Timer(): counter(0) {};    bool elasped(clock_t ms)    {   clock_t tick = std::clock();   if(tick - counter >= ms)   {   counter = tick;   return true;   }   return false;    }};#endif main.cpp#include <iostream>#include "timer.h"int main(){    Timer timer;    while(true)    {   if(timer.elasped(1000))  std::cout << "ding!\n";    }} 