Skip to content

Commit 6a7d3d0

Browse files
committed
Round microseconds on setitimer upwards.
1 parent 0553a05 commit 6a7d3d0

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/backend/port/win32/timer.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.11 2006/08/09 20:40:56 momjian Exp $
14+
* $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.12 2006/08/09 21:18:13 momjian Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -57,12 +57,9 @@ pg_timer_thread(LPVOID param)
5757
waittime = INFINITE; /* Cancel the interrupt */
5858
else
5959
{
60-
/* Minimum wait time is 1ms */
61-
if (timerCommArea.value.it_value.tv_sec == 0 &&
62-
timerCommArea.value.it_value.tv_usec < 1000)
63-
timerCommArea.value.it_value.tv_usec = 1000;
64-
/* WaitForSingleObjectEx() uses milliseconds */
65-
waittime = timerCommArea.value.it_value.tv_usec / 1000 + timerCommArea.value.it_value.tv_sec * 1000;
60+
/* WaitForSingleObjectEx() uses milliseconds, round up */
61+
waittime = (timerCommArea.value.it_value.tv_usec + 999) / 1000 +
62+
timerCommArea.value.it_value.tv_sec * 1000;
6663
}
6764
ResetEvent(timerCommArea.event);
6865
LeaveCriticalSection(&timerCommArea.crit_sec);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy