Skip to content

poll: Use GetTickCount64 to avoid wraparound issues #993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

shoelzer
Copy link

From Visual Studio 2015 Code Analysis: Warning C28159 Consider using
'GetTickCount64' instead of 'GetTickCount'. Reason: GetTickCount
overflows roughly every 49 days. Code that does not take that into
account can loop indefinitely. GetTickCount64 operates on 64 bit
values and does not have that problem

From Visual Studio 2015 Code Analysis: Warning C28159 Consider using
'GetTickCount64' instead of 'GetTickCount'. Reason: GetTickCount
overflows roughly every 49 days. Code that does not take that into
account can loop indefinitely.  GetTickCount64 operates on 64 bit
values and does not have that problem
@@ -462,7 +462,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)
if (timeout != INFTIM)
{
orig_timeout = timeout;
start = GetTickCount();
start = GetTickCount64();

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@PhilipOakley
Copy link

@linquize I was wondering about that (XP support) for those who have a difficult work/home split.

A discussion on the Notepadd++ issues pages did indicate that it was available on XP SP2 and XP SP3. Meanwhile Microsoft are obviously not advertising an XP capability for GetTickCount64.

When I get a moment I'll see if my little m/c could cope, though it's not a show stopper anyway as formal XP support by GfW ended with 2.10.0, but we can be kind when it's reasonable ;-)

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shoelzer thank you for your contribution!

As per the convention of the upstream Git project, please sign off on your patches.

Also, as per the convention of Git for Windows, please squash the fixup commit into the first one: when I have to submit the patches upstream, I cannot submit a patch that introduces a bug when the bug fix is provided by another patch in the same patch series, the upstream Git maintainer would never accept it.

Thanks.

@@ -462,7 +462,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)
if (timeout != INFTIM)
{
orig_timeout = timeout;
start = GetTickCount();
start = GetTickCount64();

This comment was marked as off-topic.

@shoelzer
Copy link
Author

This PR has been replaced by #1003. I was doing this using the GitHub website but can't figure out how to make the requested changes on the site. Now I have a proper clone. Thanks for your patience.

@shoelzer shoelzer closed this Dec 19, 2016
@shoelzer shoelzer deleted the patch-1 branch December 21, 2016 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants