On Jun 28, 2005, at 7:46 AM, Tommy Schell wrote: I have a timer set up in my driver, for Tiger and Xcode 2.0 I now get compile errors regarding some of the kernel AbsoluteTime conversion routines, which I didn't get before with Xcode 1.5 and Panther:
1) I was using ADD_ABSOLUTETIME (AbsoluteTime*, AbsoluteTime*) , but now I'm told it is "not declared in this scope".
2) Then I get several errors saying "cannot convert from AbsoluteTime* to uint64_t* for: get_clock_uptime(uint64_t*); nanoseconds_to_absolutetime(uint64_t, uint64_t*);
Any ideas? When I installed Xcode 2.0 I selected the Mac OS Tiger SDK.
Well, I can't say why, but the Kernel folk removed all the ABSOLUTETIME macros from kern/clock.h and apparently didn't provide replacements. You can see the differences with
$ opendiff /Developer/SDKs/MacOSX10.3.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/kern/clock.h /Developer/SDKs/MacOSX10.4.0.sdk/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/kern/clock.h
This has been reported as rdar://4111220 but note also that the typedef of AbsoluteTime has changed from an UnsignedWide to a UInt64. Your code will probably have to change to accommodate this. You can use the macro MAC_OS_X_VERSION_MAX_ALLOWED to determine whether you're building against Tiger headers.
For reference, here are the definitions that were removed from clock.h. It's possible that things will work again if you just add these to a local header, but then again, they might not (the first eight are extremely bad form, essentially overlaying a function call with a macro having the same name).
#define clock_get_uptime(a) \ clock_get_uptime(__OSAbsoluteTimePtr(a))
#define clock_interval_to_deadline(a, b, c) \ clock_interval_to_deadline((a), (b), __OSAbsoluteTimePtr(c))
#define clock_interval_to_absolutetime_interval(a, b, c) \ clock_interval_to_absolutetime_interval((a), (b), __OSAbsoluteTimePtr(c))
#define clock_absolutetime_interval_to_deadline(a, b) \ clock_absolutetime_interval_to_deadline(__OSAbsoluteTime(a), __OSAbsoluteTimePtr(b))
#define clock_deadline_for_periodic_event(a, b, c) \ clock_deadline_for_periodic_event(__OSAbsoluteTime(a), __OSAbsoluteTime(b), __OSAbsoluteTimePtr(c))
#define clock_delay_until(a) \ clock_delay_until(__OSAbsoluteTime(a))
#define absolutetime_to_nanoseconds(a, b) \ absolutetime_to_nanoseconds(__OSAbsoluteTime(a), (b))
#define nanoseconds_to_absolutetime(a, b) \ nanoseconds_to_absolutetime((a), __OSAbsoluteTimePtr(b))
#define AbsoluteTime_to_scalar(x) (*(uint64_t *)(x))
#define CMP_ABSOLUTETIME(t1, t2) \ (AbsoluteTime_to_scalar(t1) > \ AbsoluteTime_to_scalar(t2)? (int)+1 : \ (AbsoluteTime_to_scalar(t1) < \ AbsoluteTime_to_scalar(t2)? (int)-1 : 0))
/* t1 += t2 */ #define ADD_ABSOLUTETIME(t1, t2) \ (AbsoluteTime_to_scalar(t1) += \ AbsoluteTime_to_scalar(t2))
/* t1 -= t2 */ #define SUB_ABSOLUTETIME(t1, t2) \ (AbsoluteTime_to_scalar(t1) -= \ AbsoluteTime_to_scalar(t2))
#define ADD_ABSOLUTETIME_TICKS(t1, ticks) \ (AbsoluteTime_to_scalar(t1) += \ (int32_t)(ticks))
Chris |