Message: 9
Date: Tue, 28 Jun 2005 10:22:32 -0700
From: Chris Espinosa <email@hidden>
Subject: Re: compile errors for Xcode 2.0: AbsoluteTime
To: XCode Users <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset="us-ascii"
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
On Jun 28, 2005, at 9:18 AM, Sean McBride wrote:
On 2005-06-28 08:46, Tommy Schell said:
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".
ADD_ABSOLUTETIME indeed doesn't seem to be anywhere in
Kernel.framework,
it was in 10.3. Maybe other functions in clock.h will help,
though none
of them seem to use AbsoluteTime, so I'm not sure which! :(
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*);
Well, AbsoluteTime is a struct and uint64_t is not, so this makes
sense. Also, watch out for endian issues!
Any ideas? When I installed Xcode 2.0 I selected the Mac OS
Tiger SDK.
I highly suggest 2.1 BTW. But I think Apple maybe goofed removing
some
of those functions...
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada