unity-time.c 817 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <config.h>
  2. #include <glib.h>
  3. #include <mono/utils/mono-compiler.h>
  4. #ifdef HAVE_SYS_TIME_H
  5. #include <sys/time.h>
  6. #endif
  7. #include "Time-c-api.h"
  8. gint64
  9. mono_msec_ticks (void)
  10. {
  11. return (gint64) UnityPalGetTicksMillisecondsMonotonic();
  12. }
  13. /* Returns the number of 100ns ticks from unspecified time: this should be monotonic */
  14. gint64
  15. mono_100ns_ticks (void)
  16. {
  17. return (gint64) UnityPalGetTicks100NanosecondsMonotonic();
  18. }
  19. /* Returns the number of 100ns ticks since 1/1/1601, UTC timezone */
  20. gint64
  21. mono_100ns_datetime (void)
  22. {
  23. return (gint64) UnityPalGetSystemTimeAsFileTime();
  24. }
  25. gint64
  26. mono_msec_boottime (void)
  27. {
  28. return (gint64) UnityPalGetTicksMillisecondsMonotonic();
  29. }
  30. #ifndef HOST_WIN32
  31. gint64 mono_100ns_datetime_from_timeval (struct timeval tv)
  32. {
  33. g_assert_not_reached();
  34. return 0;
  35. }
  36. #endif