Bug #889
NLMISC ticksToSecond error on Mac OS X (Patch included)
Status: | Closed | Start date: | 05/12/2010 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | kervala | % Done: | 100% |
|
Category: | NeL: General | |||
Target version: | Version 0.8.0 |
Description
In Ryzom client on Mac OS X all the animations are running way to fast.
I looked a bit deeper into it, the result it the attached patch.
The basic problem was, that there was a division by 1'000'000 instead of 1'000'000'000 in CTime::ticksToSecond.
I changed a few more lines for the following reason:
This function gets called very frequently, so it needs to be very fast. The original version already used a static for caching the mach_timebase_info_data_t. I now went a bit further and cache the actual conversion factor in a static. This saves us one multiplication and one division :) Yay!
I am not quite sure what happens in case of frequency scaling. As I understand it, the conversion factor should change with a changed CPU frequency. If this is the case, another patch might be necessary here.
History
#1 Updated by kervala over 8 years ago
- Status changed from New to Assigned
- Assignee set to kervala
Thanks a lot :)
#2 Updated by kervala over 8 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
Applied in changeset r106.
#3 Updated by kervala over 8 years ago
- Target version set to Version 0.8.0
#4 Updated by kervala over 8 years ago
Hum, i noticed something, didn't you forget "mach_timebase_info(&tbInfo)" to initialize tbInfo ?
#5 Updated by rti over 8 years ago
I am sorry. Two errors in a ~8 lines patch.
Here is the fixed one.
#6 Updated by kervala over 8 years ago
Applied in changeset r107.
#7 Updated by vl about 8 years ago
- Status changed from Resolved to Closed