<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: List process start dates</title>
	<atom:link href="http://boredzo.org/blog/archives/2008-02-08/list-process-start-dates/feed" rel="self" type="application/rss+xml" />
	<link>http://boredzo.org/blog/archives/2008-02-08/list-process-start-dates</link>
	<description>The personal weblog of Peter Hosey.</description>
	<pubDate>Fri, 05 Dec 2008 13:22:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2008-02-08/list-process-start-dates#comment-163930</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Mon, 11 Feb 2008 16:53:35 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-02-08/list-process-start-dates#comment-163930</guid>
		<description>&lt;p&gt;Huh. I didn't know about the .15 part before; the &lt;a href="http://developer.apple.com/documentation/Carbon/Reference/Memory_Manag_nt_Utilities/Reference/reference.html#//apple_ref/c/func/TickCount" rel="nofollow"&gt;Carbon TickCount documentation&lt;/a&gt; says simply “approximately 1/60th”. Apparently it's an artifact of the original Macs' refresh rate being 60.15 Hz.&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>Huh. I didn't know about the .15 part before; the <a href="http://developer.apple.com/documentation/Carbon/Reference/Memory_Manag_nt_Utilities/Reference/reference.html#//apple_ref/c/func/TickCount" rel="nofollow">Carbon TickCount documentation</a> says simply “approximately 1/60th”. Apparently it's an artifact of the original Macs' refresh rate being 60.15 Hz.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew Thaler</title>
		<link>http://boredzo.org/blog/archives/2008-02-08/list-process-start-dates#comment-163923</link>
		<dc:creator>Drew Thaler</dc:creator>
		<pubDate>Mon, 11 Feb 2008 16:19:37 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-02-08/list-process-start-dates#comment-163923</guid>
		<description>Process Manager ticks are pretty large: 60.15 ticks per second = roughly 16.625ms each. So you're not going to get any more precise than that. There also aren't any APIs to do Ticks since any other reference point; Ticks overflowed too soon to be useful for anything else.

TickCount() will return the number of ticks since system startup. You can use "now" as the common reference point to map ticks to a more precise date value like NSDate. Just call TickCount twice, once before and once after, and make sure you get the same value. Something like this:

&lt;pre&gt;UInt32 tc = 0;
NSDate *d = nil;
do {
 tc = TickCount();
 d = [NSDate date];
} while (tc != TickCount()); // try again if we've rolled over to the next tick&lt;/pre&gt;

After this code executes both tc and d will contain equivalent times: tc will be the time in Ticks since system startup, and d will be a corresponding NSDate (within the 16.6ms window). Since you know that the Tick frequency is 60.15Hz, a little math should do the trick from there.

Note that if your machine's uptime is greater than the TickCount wrap time (about 27 months, iirc) then I think the values in processLaunchDate will start wrapping.</description>
		<content:encoded><![CDATA[<p>Process Manager ticks are pretty large: 60.15 ticks per second = roughly 16.625ms each. So you're not going to get any more precise than that. There also aren't any APIs to do Ticks since any other reference point; Ticks overflowed too soon to be useful for anything else.</p>
<p>TickCount() will return the number of ticks since system startup. You can use "now" as the common reference point to map ticks to a more precise date value like NSDate. Just call TickCount twice, once before and once after, and make sure you get the same value. Something like this:</p>
<pre>UInt32 tc = 0;
NSDate *d = nil;
do {
 tc = TickCount();
 d = [NSDate date];
} while (tc != TickCount()); // try again if we've rolled over to the next tick</pre>
<p>After this code executes both tc and d will contain equivalent times: tc will be the time in Ticks since system startup, and d will be a corresponding NSDate (within the 16.6ms window). Since you know that the Tick frequency is 60.15Hz, a little math should do the trick from there.</p>
<p>Note that if your machine's uptime is greater than the TickCount wrap time (about 27 months, iirc) then I think the values in processLaunchDate will start wrapping.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.168 seconds -->
