Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Timing an activity



I am attempting to implement a timer to record the time elapsed while an
activity ( such as recording a track from a vinyl record) is proceeding. I
found the following code snippet-posted by an Apple engineer-which I thought
would be applicable:

[BEGIN]

AbsoluteTime start = UpTime();

// stuff to be timed
.
.
.

AbsoluteTime stop = UpTime();

AbsoluteTime delta = stop - start;

double seconds = AbsoluteToNanoSeconds(delta) * 0.000000001f;

[END]

However, I found that "AbsoluteToNanoSeconds"-rather than returning a
double, returns a UnsignedWide struct, consisting of UInt32 hi and UInt32
lo. (Also, since Absolute time is the same struct, the compiler complains
that stop and start and not valid variables) -(I did attempt to read the
headers).

In my abysmal ignorance, I do not know how to convert this struct into a
number which I can use.
Am I completely on the wrong track?
Any advice would be greatly appreciated.
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.