changing which win32 time functions are used in glib


I've been experimenting a bit with glib on win32.

I have noticed that GetSystemTimeAsFileTime() is used for all
time-related functions. So I modified gmain.c so that the time
functions use timeGetTime() instead.

After some testing, I found I could get a resolution of about 1 ms
for g_timeout_add*() functions whereas the highest resolution is
about 16 ms with the regular glib.

Actually, this is so because timeGetTime() uses the windows
multimedia timers. And the API doc says that GetSystemTimeAsFileTime()
is only called every 16 ms about.

So I have a question: Are there reasons for not using timeGetTime()
instead? Actually I didn't change anything in gthread.c and
gthread-win32.c. I just modified gmain.c.

I have compiled an app I'm working on against the modified lib and
now the app behaviour is the same on windows and linux.
The good thing is I can use g_timeout_add*() functions only and no
threads at all so my app is now very stable. And I have the same
performances on both platforms.

Emmanuel thomas-maurin

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]