<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="no"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-ietf-avtcore-leap-second-01" ipr="trust200902"
     updates="3550">
  <front>
    <title abbrev="RTP Leap Seconds">RTP and Leap Seconds</title>

    <author fullname="Kevin Gross" initials="K." surname="Gross">
      <organization>AVA Networks</organization>

      <address>
        <postal>
          <street/>

          <city>Boulder</city>

          <region>CO</region>

          <country>US</country>
        </postal>

        <email>kevin.gross@avanw.com</email>
      </address>
    </author>

    <author fullname="Ray van Brandenburg" initials="R."
            surname="van Brandenburg">
      <organization>TNO</organization>

      <address>
        <postal>
          <street>Brassersplein 2</street>

          <city>Delft</city>

          <code>2612CT</code>

          <country>the Netherlands</country>
        </postal>

        <phone>+31-88-866-7000</phone>

        <email>ray.vanbrandenburg@tno.nl</email>
      </address>
    </author>

    <date day="19" month="October" year="2012"/>

    <area>Real-time Applications and Infrastructure</area>

    <workgroup>AVTCore</workgroup>

    <keyword>Leap second</keyword>

    <keyword>RTP</keyword>

    <keyword>Real-time Transport Protocol</keyword>

    <keyword>NTP</keyword>

    <keyword>Network Time Protocol</keyword>

    <keyword>UTC</keyword>

    <keyword>Universal Coordinated Time</keyword>
	
	<keyword>TAI</keyword>
	
	<keyword>International Atomic Time</keyword>
	
	<keyword>Unix time</keyword>

    <abstract>
      <t>This document discusses issues that arise when RTP sessions span
      Universal Coordinate Time (UTC) leap seconds. It updates RFC 3550 to describe how RTP senders and
      receivers should behave in the presence of leap seconds.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro" title="Introduction">
      <t>In some media networking applications, RTP streams are referenced to a wall-clock time
      (absolute date and time). This is accomplished through use of
      the NTP timestamp field in the RTCP sender report (SR) to create a
      mapping between RTP timestamps and the wall clock. When a wall-clock
      reference is used, the play-out time for RTP packets is referenced to the
      wall clock. Smooth and continuous media play out requires a smooth and
      continuous time base. The time base used by the wall clock may include leap
      seconds which are not rendered smoothly.</t>

      <t>This document provides recommendations for smoothly rendering
      streamed media referenced to common wall clocks which do not have smooth
      or continuous behavior in the presence of leap seconds.</t>
    </section>

    <section title="Terminology">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref target="RFC2119"/>
      and indicate requirement levels for compliant implementations.</t>
    </section>

    <section anchor="background" title="Leap seconds">
      <t>The world time standard is International Atomic Time (TAI) which is based on vibrations of cesium atoms in an atomic clock. The more common Universal Coordinated Time (UTC) is based on the rotation of the Earth. In 1971 UTC was redefined in terms of TAI and the concept of leap seconds was introduced to allow UTC to remain synchronized with with the rotation of the Earth. Leap seconds are scheduled
      by the International Earth Rotation and Reference Systems Service. Leap seconds may be scheduled at the last day of any month but are preferentially scheduled for 
      December and June and secondarily March and September.<xref target="TF.460-6"/> Because Earth's rotation is
      unpredictable, leap seconds are typically not scheduled more than six
      months in advance. Leap seconds can be scheduled to either add or remove
      a second from the day. All leap second events since their introduction in 1971 have been scheduled in June or December and all have added
      seconds. This is a situation that is expected to but not guaranteed to
      continue.</t>

      <t>NOTE- The ITU is studying a proposal which could eventually eliminate
      leap seconds from UTC. As of January 2012, this proposal is expected to
      be decided no earlier than 2015.<xref target="ITU-RWP7A"/></t>

      <section anchor="UTC" title="UTC behavior during leap second">
        <t>UTC clocks insert a 61st second at the end of the day when a leap
        second is scheduled. The leap second is designated "23h 59m 60s".</t>
      </section>

      <section anchor="NTP" title="NTP behavior during leap second">
        <t>Under NTP <xref target="RFC5905"/> a leap second is inserted at the
        beginning of the last second of the day. This results in the clock
        freezing or slowing for one second immediately prior to the last
        second of the affected day. This results in the last second of the day
        having a real-time duration of two seconds.</t>
      </section>

      <section anchor="POSIX" title="POSIX behavior during leap second">
        <t>Most POSIX systems insert the leap second at the end of the last
        second of the day. This results in repetition of the last second. A
        timestamp within the last second of the day is therefore ambiguous in
        that it can refer to a moment in time in either of the last two seconds of a day
        containing a leap second.</t>
      </section>
	  
	  <section title="Summary of leap-second behaviors">
	    <t><xref target='Leap-second-behavior'/> summarizes behavior across a leap second for the wall clocks discussed above.</t>
		
		<t>The table illustrates the leap second that occurred June 30, 2012 when the offset between International Atomic time (TAI) and UTC changed from 34 to 35 seconds. The first column shows RTP timestamps for an 8 kHz audio stream. The second column shows the TAI reference. Following columns show behavior for the leap-second-bearing wall clocks described above. Time values are shown at half-second intervals.</t>
		
		<texttable anchor='Leap-second-behavior'>
			
			<ttcol align='center'>RTP</ttcol>
			<ttcol align='center'>TAI</ttcol>
			<ttcol align='center'>UTC</ttcol>
			<ttcol align='center'>POSIX</ttcol>
			<ttcol align='center'>NTP</ttcol>
			<c>8000</c>
			<c>00:00:32.500</c>
			<c>23:59:58.500</c>
			<c>23:59:58.500</c>
			<c>23:59:58.500</c>
			<c>12000</c>
			<c>00:00:33.000</c>
			<c>23:59:59.000</c>
			<c>23:59:59.000</c>
			<c>23:59:59.000</c>
			<c>16000</c>
			<c>00:00:33.500</c>
			<c>23:59:59.500</c>
			<c>23:59:59.500</c>
			<c>23:59:59.500</c>
			<c>20000</c>
			<c>00:00:34.000</c>
			<c>23:59:60.000</c>
			<c>23:59:59.000</c>
			<c>00:00:00.000</c>
			<c>24000</c>
			<c>00:00:34.500</c>
			<c>23:59:60.500</c>
			<c>23:59:59.500</c>
			<c>00:00:00.000</c>
			<c>28000</c>
			<c>00:00:35.000</c>
			<c>00:00:00.000</c>
			<c>00:00:00.000</c>
			<c>00:00:00.000</c>
			<c>32000</c>
			<c>00:00:35.500</c>
			<c>00:00:00.500</c>
			<c>00:00:00.500</c>
			<c>00:00:00.500</c>
		</texttable>
	  </section>
    </section>

    <section title="Recommendations">
      <t>Senders and receivers which are not referenced to a wall clock are not
      affected by issues associated with leap seconds and no special
      accommodation is required.</t>

      <t>RTP implementation using a wall-clock reference is simplified by using
      a clock with a timescale which does not include leap seconds. IEEE
      1588 <xref target="IEEE1588-2008"/>, GPS <xref target="IS-GPS-200F"/> and
      other TAI <xref target="CircularT"/>
      references do not include leap seconds. NTP time, operating system
      clocks and other UTC (Coordinated Universal Time) references include
      leap seconds.</t>

      <t>All participants working to a leap-second-bearing reference SHOULD
      recognize leap seconds and have a working communications channel to
      receive notification of leap second scheduling. Without prior knowledge
      of leap second schedule, NTP servers and clients may become offset by
      exactly one second with respect to their UTC reference. This potential
      discrepancy begins when a leap second occurs and ends when all
      participants receive a time update from a server or peer. Depending on
      the system implementation, the offset can last anywhere from a few
      seconds to a few days. A long-lived discrepancy can be particularly
      disruptive to RTP operation.</t>

      <t>Because of the ambiguity leap seconds can introduce and the
      inconsistent manner in which different systems accommodate leap seconds,
      generating or using NTP timestamps during the entire last second of a
      day on which a leap second has been scheduled SHOULD be avoided. Note
      that the period to be avoided has a real-time duration of two
      seconds. In the <xref target='Leap-second-behavior'/> example, the region to be avoided is indicated by RTP timestamps 12000 through 28000</t>

      <section anchor="reports"
               title="RTP Sender Reports and Receiver Reports">
        <t>RTP Senders working to a leap-second-bearing reference SHOULD NOT
        generate sender reports containing an originating NTP timestamp in the
        vicinity of a leap second. Receivers SHOULD ignore timestamps in any
        such reports inadvertently generated.</t>
      </section>

      <section anchor="playout" title="RTP Packet Playout">
        <t>Receivers working to a leap-second-bearing reference SHOULD take
        leap seconds in their reference into account in determining play-out
        time from RTP timestamps for data in RTP packets.</t>
      </section>
    </section>

    <section anchor="security" title="Security Considerations">
      <t>It is believed that the recommendations herein introduce no new
      security considerations beyond those already discussed in <xref
      target="RFC3550"/>.</t>
    </section>
	
	<section anchor="IANA" title="IANA Considerations">
		<t>This document has no actions for IANA.</t>
	</section>

    <section title="Acknowledgements">
      <t>The authors would like to thank Steve Allen for his valuable comments
      in helping to improve this document. </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <reference anchor="RFC3550">
        <front>
          <title>RTP: A Transport Protocol for Real-Time Applications,
          RFC3550</title>

          <author fullname="H. Schulzrinne" initials="H."
                  surname="Schulzrinne">
            <organization/>
          </author>

          <author fullname="S. Casner" initials="S." surname="Casner">
            <organization/>
          </author>

          <author fullname="R. Frederick" initials="R." surname="Frederick">
            <organization/>
          </author>

          <author fullname="V. Jacobson" initials="V." surname="Jacobson">
            <organization/>
          </author>

          <date day="" month="July" year="2003"/>
        </front>
      </reference>

      <reference anchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement
          Levels</title>

          <author fullname="Scott Bradner" initials="S." surname="Bradner">
            <organization/>
          </author>

          <date month="March" year="1997"/>
        </front>
      </reference>

	<reference anchor="TF.460-6">
        <front>
          <title>Recommendation ITU-R TF.460-4 - Standard-frequency and time-signal emissions</title>

          <author fullname="">
            <organization>ITU-R</organization>
          </author>

          <date day="28" month="February" year="2002"/>
        </front>
      </reference>
	  
	  <reference anchor="ITU-RWP7A">
		<front>
			<title>Question SG07.236</title>
          <author fullname="">
            <organization>ITU-R Working Party 7A</organization>
          </author>
          <date day="3" month="February" year="2012"/>
		</front>
	  </reference>

      <reference anchor="RFC5905">
        <front>
          <title>Network Time Protocol Version 4: Protocol and Algorithms
          Specification</title>

          <author fullname="D. Mills" initials="D." surname="Mills">
            <organization/>
          </author>

          <author fullname="U. Delaware" initials="U. " surname="Delaware">
            <organization/>

            <address>
              <postal>
                <street/>

                <city/>

                <region/>

                <code/>

                <country/>
              </postal>

              <phone/>

              <facsimile/>

              <email/>

              <uri/>
            </address>
          </author>

          <author fullname="J. Martin" initials="J." role="editor"
                  surname="Martin">
            <organization/>

            <address>
              <postal>
                <street/>

                <city/>

                <region/>

                <code/>

                <country/>
              </postal>

              <phone/>

              <facsimile/>

              <email/>

              <uri/>
            </address>
          </author>

          <author fullname="J. Burbank" initials="J." surname="Burbank">
            <organization/>

            <address>
              <postal>
                <street/>

                <city/>

                <region/>

                <code/>

                <country/>
              </postal>

              <phone/>

              <facsimile/>

              <email/>

              <uri/>
            </address>
          </author>

          <author fullname="W. Kasch" initials="W." surname="Kasch">
            <organization/>

            <address>
              <postal>
                <street/>

                <city/>

                <region/>

                <code/>

                <country/>
              </postal>

              <phone/>

              <facsimile/>

              <email/>

              <uri/>
            </address>
          </author>

          <date month="June" year="2010"/>
        </front>
      </reference>

      <reference anchor="IEEE1588-2008">
        <front>
          <title>IEEE Standard for a Precision Clock Synchronization Protocol
          for Networked Measurement and Control Systems</title>

          <author>
            <organization>IEEE</organization>
          </author>

          <date day="24" month="July" year="2008"/>
        </front>
      </reference>

      <reference anchor="IS-GPS-200F">
        <front>
          <title>Navstar GPS Space Segment/Navigation User Segment
          Interfaces</title>

          <author>
            <organization>Global Positioning Systems
            Directorate</organization>
          </author>

          <date day="21" month="September" year="2011"/>
        </front>
      </reference>

      <reference anchor="CircularT">
        <front>
          <title>Circular T</title>

          <author>
            <organization>BIPM</organization>
          </author>

          <date day="9" month="May" year="2012"/>
        </front>
      </reference>
	  
    </references>
  </back>
</rfc>
