Re: AbsoluteTime question...
Re: AbsoluteTime question...
- Subject: Re: AbsoluteTime question...
- From: Quinn <email@hidden>
- Date: Fri, 27 Feb 2004 16:15:10 +0000
At 8:44 -0700 27/2/04, Thomas E. Knowlton, Jr. wrote:
What do you think of the following interpretation of that statement:
Well, it looks like meaningless C++ goop to me (-:
Only kiddin'. If the goal is to process packets for 100 ms, this
looks fine. AbsoluteTime is an abstraction of the PowerPC Time Base
Register (TBR). It counts up at some fixed rate that's deliberately
not documented so that we have the option of changing it as systems
change [1]. However, you can treat AbsoluteTime as a 64-bit integer
and do meaningful calculations on it. For example, you can
difference two times to get a delta or, as you do here, compare them
to see whether one is greater than the other.
So, assuming the C++ goop just casts the AbsoluteTime to a 64-bit
integer, your code should work just hunky dory. In fact, it is
pretty much exactly what I would've done because it only makes one
function call (UpTime, very fast) in the loop.
btw I'm assuming that you break out of the loop it OTRcv returns kOTNoDataErr.
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
Notes:
------
1. The event counted by TBR is processor specific. On most PowerPCs
(603, 604, G3, G4), it counts bus cycles. However, IIRC on G5 it
counts clock cycles / 8. Worse yet, the PowerPC 601 did not have a
TBR register so we had to use the RTOC register, which counted in
nanoseconds. AbsoluteTime abstracts all of this mess away. The take
home lesson: don't try to place too much meaning on the exact
frequency of AbsoluteTime.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.