<?xml version="1.0" encoding="UTF-8"?>

<rdf:RDF 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns="http://purl.org/rss/1.0/"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
>

  <channel rdf:about="http://lwn.net/headlines/209101/">
    <title>LWN: Comments on "Counting on the time stamp counter"</title>
    <link>http://lwn.net/Articles/209101/</link>
    <description>
This is a special feed containing comments posted
to the individual LWN article titled &quot;Counting on the time stamp counter&quot;.

    </description>

    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>2</syn:updateFrequency>
    <items>
      <rdf:Seq>
	<rdf:li resource="http://lwn.net/Articles/211789/rss" />
	<rdf:li resource="http://lwn.net/Articles/211728/rss" />
	<rdf:li resource="http://lwn.net/Articles/210126/rss" />
	<rdf:li resource="http://lwn.net/Articles/209984/rss" />
	<rdf:li resource="http://lwn.net/Articles/209973/rss" />
	<rdf:li resource="http://lwn.net/Articles/209747/rss" />
	<rdf:li resource="http://lwn.net/Articles/209750/rss" />
	<rdf:li resource="http://lwn.net/Articles/209698/rss" />
	<rdf:li resource="http://lwn.net/Articles/209687/rss" />
	<rdf:li resource="http://lwn.net/Articles/209680/rss" />
      
      </rdf:Seq>
    </items>

  </channel>
    <item rdf:about="http://lwn.net/Articles/211789/rss">
      <title>How to ensure monotonic nondecreasing time</title>
      <link>http://lwn.net/Articles/211789/rss</link>
      <dc:date>2006-11-29T17:19:41+00:00</dc:date>
      <dc:creator>giraffedata</dc:creator>
      <description>
      &lt;blockquote&gt;
I guess zooko alluded to leap seconds, where UTC stands still for 
(actually: jumps backwards by) a second.
&lt;/blockquote&gt;
&lt;p&gt;
Ah.  That's probably it.
&lt;p&gt;
Except that UTC does not stand still or go backwards.  When there's a leap second, UTC goes steadily forward from 23:59:59 to 23:59:60 and then to 00:00:00.  Note that a UTC time of day is a tuple of numbers (year, month, day, hour, minute, second).
&lt;p&gt;
But the standard Linux time representation (a single number) &lt;em&gt;does&lt;/em&gt; step backward at leap second time; it's defined that way to make it easy to compute UTC from it.
&lt;p&gt;
And I think zooko's statement that a programmer can't have a time that is both monotonically nondecreasing and correlates to a human time standard has to be qualified to the case that the time is represented by a single number.  As long as you're willing to work with multiple numbers, two obvious ways are TAI + delta as you suggest, and just plain UTC.

      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/211728/rss">
      <title>How to ensure monotonic nondecreasing time</title>
      <link>http://lwn.net/Articles/211728/rss</link>
      <dc:date>2006-11-29T12:37:39+00:00</dc:date>
      <dc:creator>robbe</dc:creator>
      <description>
      I guess zooko allured to leap seconds, where UTC stands still for &lt;br&gt;
(acually: jumps backwards by) a second. Maybe keeping TAI and the current &lt;br&gt;
delta is the answer to this one?&lt;br&gt;
&lt;p&gt;
See &lt;a rel=&quot;nofollow&quot; href=&quot;http://en.wikipedia.org/wiki/Coordinated_Universal_Time&quot;&gt;http://en.wikipedia.org/wiki/Coordinated_Universal_Time&lt;/a&gt;&lt;br&gt;
      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/210126/rss">
      <title>How to ensure monotonic nondecreasing time</title>
      <link>http://lwn.net/Articles/210126/rss</link>
      <dc:date>2006-11-17T23:09:01+00:00</dc:date>
      <dc:creator>giraffedata</dc:creator>
      <description>
      &lt;blockquote&gt;
Programmers need to realize that they cannot have both monotonically non-decreasing (or monotonically increasing) *and* &quot;correlates to shared human date-time e.g. UTC&quot;.
&lt;/blockquote&gt;
&lt;p&gt;
Can you elaborate?  I think you're saying that if I want a clock that correlates to UTC, it must necessarily step backwards sometimes.  I don't see why.

      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/209984/rss">
      <title>Counting on the time stamp counter</title>
      <link>http://lwn.net/Articles/209984/rss</link>
      <dc:date>2006-11-17T07:04:05+00:00</dc:date>
      <dc:creator>rise</dc:creator>
      <description>
      Interesting, I've been seeing soft-locks for months as well.  Oddly enough though almost nothing else responds on my laptop (basically only the keyboard lamp), toggling volume up and down will sometimes pop it out of lockup immediately.&lt;br&gt;
      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/209973/rss">
      <title>How to ensure monotonic nondecreasing time</title>
      <link>http://lwn.net/Articles/209973/rss</link>
      <dc:date>2006-11-17T05:10:27+00:00</dc:date>
      <dc:creator>zooko</dc:creator>
      <description>
      Programmers need to realize that they cannot have both monotonically non-decreasing (or monotonically increasing) *and* &quot;correlates to shared human date-time e.g. UTC&quot;.  Sometimes you require the latter and can live without the former.  Sometimes it is the other way around.&lt;br&gt;
&lt;p&gt;
Unfortunately Unix and Linux haven't traditionally offered the former to user-land programmers (although I'm told that Linux kernel code itself has long required monotonic timers for some things).&lt;br&gt;
&lt;p&gt;
The current state of the art appears to be an ill-considered belief that you can have most of both most of the time (possibly because there is a human sysadmin finessing the difference for you) and and that the occasional violation of one or both of those requirements probably won't hurt too much.  Bah.  I hate that kind of irresponsible engineering.&lt;br&gt;
&lt;p&gt;
(&quot;Occasional incorrectness won't hurt too much&quot; thinking can often get by for years -- until a malicious actor gets involved who knows how to cause or to exploit this occasional incorrectness.  In any case occasional incorrectness can occasionally cause planes to crash, precious documents to be deleted, etc.)&lt;br&gt;
&lt;p&gt;
I believe that recent modern Linux and glibc do offer a monotonically increasing timer (i.e. implementing CLOCK_MONOTONIC for clock_gettime()).  Now if only programmers will come to realize that they sometimes need it...&lt;br&gt;
&lt;p&gt;
(P.S.  An even more subtle and vexing problem is that you cannot have both monotonicity *and* &quot;the rate of the passage of time correlates with a standard notion of the rate of time&quot;.)&lt;br&gt;
&lt;p&gt;
      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/209747/rss">
      <title>What do other platforms do?</title>
      <link>http://lwn.net/Articles/209747/rss</link>
      <dc:date>2006-11-16T13:48:49+00:00</dc:date>
      <dc:creator>brugolsky</dc:creator>
      <description>
      It is quite remarkable just how many clocks are in a typical PC, all of which have serious drawbacks. Vojtech Pavlik provided a nice &lt;A href=&quot;http://lkml.org/lkml/2005/11/18/261&quot;&gt;summary&lt;/A&gt; a while back:
&lt;P&gt;
&lt;OL&gt;
&lt;LI&gt; RTC: 0.5 sec resolution, interrupts
&lt;LI&gt; PIT: takes ages to read, overflows at each timer interrupt
&lt;LI&gt; PMTMR: takes ages to read, overflows in approx 4 seconds, no interrupt
&lt;LI&gt; HPET: slow to read, overflows in 5 minutes. Nice, but usually not present.
&lt;LI&gt; TSC: fast, completely unreliable. Frequency changes, CPUs diverge over time.
&lt;LI&gt; LAPIC: reasonably fast, unreliable, per-cpu
&lt;/OL&gt;
&lt;P&gt;
Linux timekeeping has always been a black art, and until John Stultz's rewrite, seemed to me to proceed from the wrong direction.  At least now it  looks comprehensible.
&lt;P&gt;
Do other kernels (*BSD, Solaris) take a markedly different approach?
&lt;P&gt;
There does seem to be some work going on to make the TSC more useful on SMP systems, e.g., &lt;A href=&quot;http://lkml.org/lkml/2006/11/13/373&quot;&gt;[PATCH 1/2] Make the TSC safe to be used by gettimeofday()&lt;/A&gt;. 

      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/209750/rss">
      <title>Counting on the time stamp counter</title>
      <link>http://lwn.net/Articles/209750/rss</link>
      <dc:date>2006-11-16T13:13:25+00:00</dc:date>
      <dc:creator>rvfh</dc:creator>
      <description>
      &lt;p&gt;I hope they fix the bug that soft locks my kernel for 2 minutes 
when somebody contacts me via Skype in the process (&lt;a 
href=&quot;http://forum.skype.com/lofiversion/index.php/t42232.html&quot;&gt;Skype 
forums&lt;/a&gt; and &lt;a 
href=&quot;http://lkml.org/lkml/2006/10/11/200&quot;&gt;LKML&lt;/a&gt;), as someone said it 
was potentially HPET/TSC related.&lt;/p&gt;
&lt;p&gt;This DoS attack does not seem to be of much interest to kernel 
developers 
though, so I won't hold my breath! I guess that puts me in the 1/5th who 
are impacted by a kernel bug then...&lt;/p&gt;
      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/209698/rss">
      <title>How to ensure monotonic nondecreasing time</title>
      <link>http://lwn.net/Articles/209698/rss</link>
      <dc:date>2006-11-16T06:26:33+00:00</dc:date>
      <dc:creator>pjm</dc:creator>
      <description>
      One way of guaranteeing that &amp;lsquo;time never goes backwards&amp;rsquo; is to use a variant of &lt;a href=&quot;http://en.wikipedia.org/wiki/Lamport_timestamps&quot; &gt;Lamport timestamps&lt;/a&gt; (or see &lt;a href=&quot;http://research.microsoft.com/users/lamport/pubs/time-clocks.pdf&quot; &gt;full paper&lt;/a&gt;).  For gettimeofday, we have it a bit easier: gettimeofday gives only microsecond precision, so it only guarantees that time never goes backwards, it doesn't guarantee that time advances between two events.  Thus, we don't even need the property that distinct events have distinct timestamps, so we don't need the process ID stuff mentioned on that page, and we could go so far as to ~gratuitously drop the &amp;ldquo;and then applies rule 1 before timestamping the event as received&amp;rdquo; part from rule 3.

&lt;p&gt;[Dropping that part of rule 3 would more often expose callers mistakenly assuming that time strictly increases.  Exposing bugs more often may be either a good or bad thing.]&lt;/p&gt;
      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/209687/rss">
      <title>Counting on the time stamp counter</title>
      <link>http://lwn.net/Articles/209687/rss</link>
      <dc:date>2006-11-16T04:41:36+00:00</dc:date>
      <dc:creator>PaulMcKenney</dc:creator>
      <description>
      The rumor I hear is that reading TSC does some degree of instruction-stream serialization.  Someone from Intel or AMD might be able to shed better light on the performance of rdtsc.&lt;br&gt;
      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/209680/rss">
      <title>Counting on the time stamp counter</title>
      <link>http://lwn.net/Articles/209680/rss</link>
      <dc:date>2006-11-16T03:23:59+00:00</dc:date>
      <dc:creator>jreiser</dc:creator>
      <description>
      &lt;i&gt;The TSC can also be read quickly (it is just a CPU register, after all) ...&lt;/i&gt;
&lt;p&gt;
This theory has never been correct for x86 processors.  The minimum cost for &lt;tt&gt;rdtsc&lt;/tt&gt; was 9 cycles in a PentiumMMX-166MHz.  On a Pentium4Xeon-3.0GHz it takes 97 cycles.  The conclusion?  The hardware reads TSC serially one bit at a time, or one byte at a time on old processors.

      
      </description>
    </item>
</rdf:RDF>

