Hi All,
I'm having what seems to be a very strange problem. I have a master Time Base for my entire
application that
counts in microseconds. In certain situations, at quite random intervals, when I retrieve the
current time with
GetTimeBaseTime(), the time is totally incorrect. This only happens on the Intel Mac -- this
code has worked for
ages on PowerPC.
Let me say at the outset that the time base is created in the main thread, and accessed from
the main thread
(albeit from a Carbon Timer Callback.)
Basically, the progression of events is as follows:
1) Carbon Timer Event fires, calling the callback for this timer in the main program
2) The timer callbak function calls a function inside a dynamically loaded plugin (N.B. one
created specifically
for my application)
3) The plugin calls a callback in the main program
4) The main program calls GetTImeBaseTime() to retrieve the current time.
5) Most often, the result is correct. But sometimes the result (microseconds, remember) is
some gigantic
number that, when divided by 1000 to convert it to milliseconds, does not fit into a UInt32.
Note that, upon getting an out of range value, I use the debugger to step back in XCode to
the
GetTimeBaseTime() call and do it again, it returns a valid value!
Now, thinking there was some thread safety issue happening (even though I'm calling from
the main thread) or
perhaps something to do with having two processors, I switched to using UpTime() to get the
current time in
nanoseconds. But upon using AboluteToNanoseconds to ensure the result was in fact
expressed in
nanoseconds, the same problem as described above would occur. Interestingly, if I just used
the return value
from UpTime() it works fine and the number is always a value that one would expect. (This
would be non-
standard of course, but it seems that the return value of UpTime() on my MacBookPro is in
fact nanoseconds.)
Does anyone have any advice about this? Could it have to do with the fact that I am calling
GetTimeBaseTime(0
from a Carbon Timer callback? Or is there some possibility that passing through my
dynamically loaded plugin
is causing the problem?
Thanks in advance for your thoughts,
Mark
=========================================================
==
Mark Coniglio | email@hidden
TroikaTronix | http://www.troikatronix.com/
Isadora® | http://www.troikatronix.com/isadora.html
=========================================================
==
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden
This email sent to email@hidden