[Mono-dev] [PATCH] Get system time more efficiently on Windows

Zoltan Varga vargaz at gmail.com
Fri Dec 5 12:47:20 EST 2008


Hi,

  Looks good.

          Zoltan

2008/12/5 Kornél Pál <kornelpal at gmail.com>:
> Hi,
>
> Please review and approve the patch.
>
> Thanks.
>
> Kornél
>
> Index: mono/mono/utils/mono-time.c
> ===================================================================
> --- mono/mono/utils/mono-time.c (revision 120853)
> +++ mono/mono/utils/mono-time.c (working copy)
> @@ -42,12 +42,13 @@
>  gint64
>  mono_100ns_datetime (void)
>  {
> -       SYSTEMTIME st;
> -       FILETIME ft;
> +       ULARGE_INTEGER ft;
>
> -       GetSystemTime (&st);
> -       SystemTimeToFileTime (&st, &ft);
> -       return (gint64) FILETIME_ADJUST + ((((gint64)ft.dwHighDateTime)<<32)
> | ft.dwLowDateTime);
> +       if (sizeof(ft) != sizeof(FILETIME))
> +               g_assert_not_reached ();
> +
> +       GetSystemTimeAsFileTime ((FILETIME*) &ft);
> +       return FILETIME_ADJUST + ft.QuadPart;
>  }
>
>  #else
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>


More information about the Mono-devel-list mailing list