Provides the current time at a millisecond resolution. Each DTime stores a time value that can be used to determine how much time has elapsed:
DTime myTime; //Store the current time myTime.updateTime(); //Sleep for half a second DEngine::sleep(500); //Output the difference between the stored and current time cout << myTime.timeElapsed() << endl;
The default constructor.
Creates an object that is an copy of source.
Sets this object to be a copy of source.
Adds amount milliseconds to the stored time.
Returns the milliseconds component of the stored time.
Returns the seconds component of the stored time.
Sets the stored time to the specified number of seconds and milliseconds.
Returns the difference between the current time and the stored time in milliseconds.
Sets the stored time to the current time.
Normally, the timeElapsed and updateTime functions perform a system call to get the current system time. This is a relatively expensive operation, and can be inefficient if there are hundreds of DTime objects. The DEngine stores the current time each time its update function is called. Any DTime objects that are registered with that engine will use its stored value instead of retrieving the system time themselves. Set engine to NULL to return to the DTime's default behaviour.