text: Checked and found that time_T pretty much has to be an integer. Most implementations will overrflow in the year 2038, henceforth the type will most likely be 64-bit.
  Printable View
  Checked and found that time_T pretty much has to be an integer. Most implementations will overrflow in the year 2038, henceforth the type will most likely be 64-bit.
  Heh. The year 2038 bug.
  I would have thought they'd modify the start date for the clock mechanism to a newer date. Or better yet make a preprocessor that adds the current date when it compiles the compiler.
  Also if you dont mind windows specific code you can look up QueryPerformanceCounter and QueryPerformanceFrequency.
  >Checked and found that time_T pretty much has to be an integer.
  No, it doesn't. time_t can be a floating point type just as easily as a signed or unsigned integral type. The size and representation are completely up to the implementation, so you cannot assume anything more than the fact that time_t is arithmetic, and can be used to compare with (time_t)-1. Everything else is non-portable.
  unless you wanted it to be syncronized while the computers shut down or the same as the computer clock you can do this
  almost positive i didn't make any mistakes-i hopealmost positive i didn't make any mistakes-i hopeCode:
  #include <iostream.h>
  #include <windows.h>
  int main()
  {
  int loop; // in case you wanted it to do something over and over
  for (loop=0;loop>=0;loop++)
  {
  Sleep(60000); // a minute, one second is 1000, do the math
  cout << "\a";
  }
  return 0;
  }
  a few, actually... here's what the code should look like:a few, actually... here's what the code should look like:Quote:
  Originally Posted by killdragon
  Code:
  #include <iostream> //<iostream.h> is depreciated
  #include <windows.h> //not too sure about this one
  int main()
  {
  //for (int loop=0;loop>=0;loop++) //infinite loop - might as well declare loop here
  //because it most likely won't be used outside the
  //scope of the loop
  for(;;) //does the same as above, but saves a teeny bit of memory
  {
  Sleep(60000); //inadvisable - not portable, but it does free up the CPU
  cout << "\a"; //ringing the system bell every minute...
  }
  return 0;
  }
  >//<iostream.h> is depreciated
  Deprecated means that something is still standard but not assured to be in the next revision. iostream.h is not a part of the C++ standard at all, deprecated or not. So while an implementation is allowed to give you iostream.h according to the rules of implementation-dependent extensions, the standard makes no guarantees as to its contents. I could legally write a compiler that supports iostream.h and leave it empty. ;)
  >//not too sure about this one
  It should exist on a Windows box, otherwise I wouldn't hold my breath.