5 #ifndef __UTILS_MONO_TIME_H__
6 #define __UTILS_MONO_TIME_H__
8 #include <mono/utils/mono-compiler.h>
11 #ifdef HAVE_SYS_TIME_H
15 /* Returns the number of milliseconds from boot time: this should be monotonic
17 * Prefer to use mono_msec_ticks for elapsed time calculation. */
18 gint64 mono_msec_boottime (void);
20 /* Returns the number of milliseconds ticks from unspecified time: this should be monotonic */
21 gint64 mono_msec_ticks (void);
23 /* Returns the number of 100ns ticks from unspecified time: this should be monotonic */
24 gint64 mono_100ns_ticks (void);
26 /* Returns the number of 100ns ticks since 1/1/1601, UTC timezone */
27 gint64 mono_100ns_datetime (void);
30 gint64 mono_100ns_datetime_from_timeval (struct timeval tv);
33 /* Stopwatch class for internal runtime use */
39 mono_stopwatch_start (MonoStopwatch *w)
41 w->start = mono_100ns_ticks ();
46 mono_stopwatch_stop (MonoStopwatch *w)
48 w->stop = mono_100ns_ticks ();
52 mono_stopwatch_elapsed (MonoStopwatch *w)
54 return (w->stop - w->start) / 10;
58 mono_stopwatch_elapsed_ms (MonoStopwatch *w)
60 return (mono_stopwatch_elapsed (w) + 500) / 1000;
63 #endif /* __UTILS_MONO_TIME_H__ */