diff options
author | darin%meer.net <devnull@localhost> | 2003-11-18 06:14:57 +0000 |
---|---|---|
committer | darin%meer.net <devnull@localhost> | 2003-11-18 06:14:57 +0000 |
commit | 3473e3827477d4477c9c2cfc0da30030e0929e6d (patch) | |
tree | 0a47a0f1eb38a6991d404f3acb1005f1ada3d304 | |
parent | d6e5fe7995607e687f2ee8f5d20a404540750c22 (diff) | |
download | nspr-hg-3473e3827477d4477c9c2cfc0da30030e0929e6d.tar.gz |
fixes bug 226022 "overflow error in PR_Poll means timeout < 1 second returns too quickly" patch=brofield@jellycan.com r=wtc,darin
-rw-r--r-- | pr/src/md/beos/bfile.c | 3 | ||||
-rw-r--r-- | pr/src/md/os2/os2poll.c | 3 | ||||
-rw-r--r-- | pr/src/md/unix/uxpoll.c | 3 | ||||
-rw-r--r-- | pr/src/md/windows/w32poll.c | 3 |
4 files changed, 4 insertions, 8 deletions
diff --git a/pr/src/md/beos/bfile.c b/pr/src/md/beos/bfile.c index 6fd6cce9..95206f30 100644 --- a/pr/src/md/beos/bfile.c +++ b/pr/src/md/beos/bfile.c @@ -689,8 +689,7 @@ _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) { PRInt32 ticksPerSecond = PR_TicksPerSecond(); tv.tv_sec = remaining / ticksPerSecond; - tv.tv_usec = remaining - (ticksPerSecond * tv.tv_sec); - tv.tv_usec = (PR_USEC_PER_SEC * tv.tv_usec) / ticksPerSecond; + tv.tv_usec = PR_IntervalToMicroseconds( remaining % ticksPerSecond ); tvp = &tv; } diff --git a/pr/src/md/os2/os2poll.c b/pr/src/md/os2/os2poll.c index 5bf84e3b..09927717 100644 --- a/pr/src/md/os2/os2poll.c +++ b/pr/src/md/os2/os2poll.c @@ -237,8 +237,7 @@ retry: { PRInt32 ticksPerSecond = PR_TicksPerSecond(); tv.tv_sec = remaining / ticksPerSecond; - tv.tv_usec = remaining - (ticksPerSecond * tv.tv_sec); - tv.tv_usec = (PR_USEC_PER_SEC * tv.tv_usec) / ticksPerSecond; + tv.tv_usec = PR_IntervalToMicroseconds( remaining % ticksPerSecond ); tvp = &tv; } diff --git a/pr/src/md/unix/uxpoll.c b/pr/src/md/unix/uxpoll.c index a95e4558..c3275acf 100644 --- a/pr/src/md/unix/uxpoll.c +++ b/pr/src/md/unix/uxpoll.c @@ -402,8 +402,7 @@ retry: { PRInt32 ticksPerSecond = PR_TicksPerSecond(); tv.tv_sec = remaining / ticksPerSecond; - tv.tv_usec = remaining - (ticksPerSecond * tv.tv_sec); - tv.tv_usec = (PR_USEC_PER_SEC * tv.tv_usec) / ticksPerSecond; + tv.tv_usec = PR_IntervalToMicroseconds( remaining % ticksPerSecond ); tvp = &tv; } diff --git a/pr/src/md/windows/w32poll.c b/pr/src/md/windows/w32poll.c index 93a9a2d3..403aa004 100644 --- a/pr/src/md/windows/w32poll.c +++ b/pr/src/md/windows/w32poll.c @@ -262,8 +262,7 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) { PRInt32 ticksPerSecond = PR_TicksPerSecond(); tv.tv_sec = timeout / ticksPerSecond; - tv.tv_usec = timeout - (ticksPerSecond * tv.tv_sec); - tv.tv_usec = (PR_USEC_PER_SEC * tv.tv_usec) / ticksPerSecond; + tv.tv_usec = PR_IntervalToMicroseconds( timeout % ticksPerSecond ); tvp = &tv; } |