![]() |
|
#31
|
|||
|
|||
|
Quote:
you need to include the namespace System.Diagnostics for usage. For the query time can be for example (MissionTimer1 is the stop watch) MissionTimer1.Elapsed.Days MissionTimer1.Elapsed.Hours MissionTimer1.Elapsed.Minutes MissionTimer1.Elapsed.Seconds MissionTimer1.Elapsed.Milliseconds MissionTimer1.Elapsed.Ticks MissionTimer1.Elapsed.TotalDays MissionTimer1.Elapsed.TotalHours MissionTimer1.Elapsed.TotalMinutes MissionTimer1.Elapsed.TotalSeconds MissionTimer1.Elapsed.TotalMilliseconds There is a difference between for example Minutes and TotalMinutes etc.: MissionTimer1.Elapsed.Minutes has e.g. the range -59 to 59 minutes, only indicates the minute proportion of the total time. at 2h 43m 12s would be the 43rd MissionTimer1.Elapsed.TotalMinutes provides e.g. the total number of minutes since launch. 2h 43m 12s min at 163.12 then. Methods MissionTimer1.Start () / / Starts the timer MissionTimer1.Stop () / / Pauses the timer can be resume with Start () MissionTimer1.Restart () / / Starts the timer at 0 newly MissionTimer1.Reset () / / Resets the timer to 0 and stops the time measurement MissionTimer1.IsRunning / / bool indicates whether the timer is running (true) or not (false) Quote:
You can for example measure the time between two events etc. You need to declare a Stopwatch global and start it once, normaly OnBattleStarted(). Then you can use it in every way you like. Quote:
Don't know whats faster, a modulo calculation or a simple stopwatch request. But stopwatch is much more accurate. Last edited by FG28_Kodiak; 10-18-2011 at 05:09 AM. |
| Thread Tools | |
| Display Modes | |
|
|