• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: compile errors for Xcode 2.0: AbsoluteTime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compile errors for Xcode 2.0: AbsoluteTime


  • Subject: Re: compile errors for Xcode 2.0: AbsoluteTime
  • From: Tommy Schell <email@hidden>
  • Date: Wed, 29 Jun 2005 09:25:00 -0600

Thanks to Chris and Sean for their most helpful input.

I tried inserting the old clock.h definitions in my code, but it wouldn't accept references to AbsoluteTime.
So I gave up on that.


I switched my AbsoluteTime variables over to uint64_t, but was still running into problems.
Some calls I make to IOTimerEventSource instance and IOAudioEngine instance in my code were still expecting
an AbsoluteTime value as an argument.


So I had to cast to AbsoluteTime in these cases, using an example from qa1398:

 AbsoluteTime timer_temp = * (AbsoluteTime*) &(me->my_timer);
  me->takeTimeStamp( true, &timer_temp);


Kind of confusing, I must say, but now it seems to work. Tommy


On Jun 29, 2005, at 9:08 AM, Tommy Schell wrote:

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









_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >compile errors for Xcode 2.0: AbsoluteTime (From: Tommy Schell <email@hidden>)
 >Re: compile errors for Xcode 2.0: AbsoluteTime (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: Xcode 2.1 ignores cached precompiled header
  • Next by Date: ".rsrc" file in Xcode 2.1 and pict control
  • Previous by thread: Re: compile errors for Xcode 2.0: AbsoluteTime
  • Next by thread: Problems with "Types" in XCode 2.1 when building resources with Rez
  • Index(es):
    • Date
    • Thread