Replaced the dependency to winmm/timeGetTime() with a more portable solution (note: variable names left as-is, so they may cause confusion for a while).