(Formerly known as GetRawTime, which is now obsolete)
readonly int DateTime.RawTime;
This function returns the raw system time, as the number of seconds since January 1970.
While this value is not useful in itself, you can use it to calculate time differences
by getting the value at the start of the game, for example, and then getting the value
later on, and the difference between the two is how much time has elapsed.
NOTE: Because this accesses the real-time clock on the users' system, it is not
a good idea to use this for long term timing tasks, since if the user saves the game and
then restores it later, the Time value returned by this function will obviously include
the difference when they were not playing.
Example:
DateTime *dt = DateTime.Now;
int start_time = dt.RawTime;
Wait(120);
dt = DateTime.Now;
Display("After the wait it is now %d seconds later.", dt.RawTime - start_time);
should display that 3 seconds have elapsed.
See Also: DateTime.Now, SetTimer
|