Hi,

Dealing with any kind of time differences ought to be done using FILETIME structures, not GetTickCount(). Then you don't have the wrap-around problem in the first place.

The API you need is GetSystemTimeAsFileTime(), which returns a 64-bit value in two 32-bit DWORDs. Arithmetic on FILETIMEs is done by transferring the FILETIME to a ULARGE_INTEGER
and accessing the "QuadPart" member.

See MSDN docs on FILETIME structure and example below.
http://msdn.microsoft.com/en-us/library/windows/apps/ms724284%28v=vs.85%29.aspx

Cheers,


---------------

ULARGE_INTEGER uNowTime, uEndTime;

// 64-bit aligned access guaranteed on all platforms.
GetSystemTimeAsFileTime((PFILETIME) &uNowTime);

if (uNowTime.QuadPart >= uEndTime.QuadPart)
{
    ...
}



On 10/08/13 10:29, Ken Takata wrote:
Hi,

WaitForChar() in os_win32.c doesn't wait properly when the result of
the GetTickCount() overflows. Attached patch fixes this.

Regards,
Ken Takata

# HG changeset patch
# Parent 53e9c7a35663543713dddd91f626ff27ae9c3460

diff --git a/src/os_win32.c b/src/os_win32.c
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -1362,7 +1362,7 @@
        {
            /* If the specified wait time has passed, return. */
            dwNow = GetTickCount();
-           if (dwNow>= dwEndTime)
+           if ((int)(dwNow - dwEndTime)>= 0)
                break;
        }
        if (msec != 0)

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui