Closed Bug 16202 Opened 25 years ago Closed 25 years ago

PR_Now() resolution on Mac only 1 second

Categories

(NSPR :: NSPR, defect, P3)

PowerPC
Mac System 8.5

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sdagley, Assigned: sdagley)

References

Details

PR_Now returns a value in milliseconds but it's only got a 1 second resolution on
Mac.  This is throwing off some of the XP timing tests.

The change to 1 sec resolution was actually done to address a problem with the
time code in NSPR 1.0 as used in Communicator 4.x where any adjustments to the
system clock made after app launch were not accounted for.  My proposed fix is to
use a method similiar to the NSPR 1.x code where the Mac OS Microseconds() call
is used to calculate the PR_Now() return but also use the GetDateTime() call to
verify that the time returned is within a reasonable delta from the system clock
Blocks: 16654
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You gotta love it when you go to get something reviewed only to find out that
you've solved a problem that has already been addressed in another manner.
Rather than checkin the code that would provide microsecond resolution from
PR_Now() at the expense of more code overhead I will defer to a cleaner existing
solution:

For interval timing NSPR provides the call PR_IntervalNow() which returns a
PRIntervalTime value.  This value can be converted to milliseconds or
microseconds as required.  The NSPR header prinval.h reveals all you need to
know.
Blocks: 17432
No longer blocks: 17432
You need to log in before you can comment on or make changes to this bug.