<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
  <!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
  <title>Entity Time</title>
  <abstract>This specification defines an XMPP protocol extension for communicating the local time of an entity, including the time in UTC according to the entity as well as the offset from UTC. The time format itself conforms to the dateTime profile of ISO 8601 defined in XEP-0082.</abstract>
  &LEGALNOTICE;
  <number>0202</number>
  <status>Final</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XEP-0082</spec>
  </dependencies>
  <supersedes>
    <spec>XEP-0090</spec>
  </supersedes>
  <supersededby/>
  <shortname>time</shortname>
  <schemaloc>
    <url>http://www.xmpp.org/schemas/time.xsd</url>
  </schemaloc>
  &stpeter;
  <author>
    <firstname>Maciej</firstname>
    <surname>Niedzielski</surname>
    <email>machekku@uaznia.net</email>
    <jid>machekku@uaznia.net</jid>
  </author>
  <revision>
    <version>2.0</version>
    <date>2009-09-11</date>
    <initials>psa</initials>
    <remark><p>Per a vote of the XMPP Council, advanced specification from Draft to Final.</p></remark>
  </revision>
  <revision>
    <version>1.0</version>
    <date>2007-03-28</date>
    <initials>psa</initials>
    <remark><p>Per a vote of the XMPP Council, advanced from Experimental to Draft.</p></remark>
  </revision>
  <revision>
    <version>0.2</version>
    <date>2007-03-19</date>
    <initials>psa</initials>
    <remark><p>Added service discovery section.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2006-12-20</date>
    <initials>psa</initials>
    <remark><p>Initial version; further specified security considerations; per Council feedback, removed tz and display elements.</p></remark>
  </revision>
  <revision>
    <version>0.0.2</version>
    <date>2006-12-19</date>
    <initials>psa</initials>
    <remark><p>Clarified text; adjusted protocol definition; corrected schema.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2006-12-05</date>
    <initials>mn</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>
<section1 topic='Introduction' anchor='intro'>
  <p>Although the XMPP protocol extension defined in &xep0090; provides a way to discover the time at another entity, it has several limitations:</p>
  <ul>
    <li><p>The 'jabber:iq:time' namespace specified in <cite>XEP-0090</cite> requires communication of time only in UTC. While this is useful for UTC synchronization (e.g., if a client wants to synchronize with its server), it does not enable one entity to know the other entity's offset from UTC.</p></li>
    <li><p>The timezone may be specified in a natural language (English) name via the &lt;tz/&gt; element, but not in a numeric offest. The name may be not understood by the requesting entity since there is no reliable and canonical list of timezone names <note>A list of English-language time zone names and abbreviations is located at &lt;<link url='http://www.timeanddate.com/library/abbreviations/timezones/'>http://www.timeanddate.com/library/abbreviations/timezones/</link>&gt;, but it is not a canonical list and there are no such localized lists for all languages.</note> and in practice the XML character data of the &lt;tx/&gt; element is effectively useless.</p></li>
    <li><p>The responding entity may provide a user-friendly datetime format via the &lt;display/&gt; element, but this too is effectively useless since datetime formats vary widely by culture and nation.</p></li>
    <li><p>The 'jabber:iq:time' namespace specified in <cite>XEP-0090</cite> (first developed in 1999 or 2000) is not consistent with the recommended date and time profiles for XMPP protocols defined in &xep0082; (written in 2003).</p></li>
  </ul>
  <p>To overcome these limitations, this document defines a replacement for <cite>XEP-0090</cite> which enables communication of an entity's UTC time and numeric time zone offset while adhering to <cite>XEP-0082</cite>.</p>
</section1>
<section1 topic='Protocol Definition' anchor='protocol'>
  <p>The protocol defined herein provides a standard way for XMPP entities to exchange information about the local time. The information is communicated in a request/response pair using an &IQ; element that contains a &lt;time/&gt; element qualified by the 'urn:xmpp:time' namespace. The following children of the &lt;time/&gt; element are defined for use in IQ stanzas of type 'result':</p>
  <table caption='Child Elements'>
    <tr>
      <th>Element</th>
      <th>Definition</th>
      <th>Inclusion</th>
    </tr>
    <tr>
      <td>&lt;tzo/&gt;</td>
      <td>The entity's numeric time zone offset from UTC. The format MUST conform to the Time Zone Definition (TZD) specified in <cite>XEP-0082</cite>.</td>
      <td>REQUIRED</td>
    </tr>
    <tr>
      <td>&lt;utc/&gt;</td>
      <td>The UTC time according to the responding entity. The format MUST conform to the dateTime profile specified in <cite>XEP-0082</cite> and MUST be expressed in UTC.</td>
      <td>REQUIRED</td>
    </tr>
  </table>
</section1>
<section1 topic='Examples' anchor='examples'>
    <example caption='Querying Another Entity for the Local Time'><![CDATA[
<iq type='get'
    from='romeo@montague.net/orchard'
    to='juliet@capulet.com/balcony'
    id='time_1'>
  <time xmlns='urn:xmpp:time'/>
</iq>
]]></example>
    <example caption='A Response to the Query'><![CDATA[
<iq type='result'
    from='juliet@capulet.com/balcony'
    to='romeo@montague.net/orchard'
    id='time_1'>
  <time xmlns='urn:xmpp:time'>
    <tzo>-06:00</tzo>
    <utc>2006-12-19T17:58:35Z</utc>
  </time>
</iq>
]]></example>
    <p>The standard error conditions described in &xep0086; apply (e.g., &unavailable; if the entity does not support the namespace).</p>
</section1>
<section1 topic='Service Discovery' anchor='disco'>
  <p>If an entity supports the Entity Time protocol, it MUST report that by including a service discovery feature of "urn:xmpp:time" in response to a &xep0030; information request:</p>
  <example caption="Service Discovery information request"><![CDATA[
<iq type='get'
    from='romeo@montague.net/orchard'
    to='juliet@capulet.com/balcony'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
  <example caption="Service Discovery information response"><![CDATA[
<iq type='result'
    from='juliet@capulet.com/balcony'
    to='romeo@montague.net/orchard'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    ...
    <feature var='urn:xmpp:time'/>
    ...
  </query>
</iq>
]]></example>
</section1>
<section1 topic='Implementation Notes' anchor='impl'>
  <p>This protocol was designed in a way that makes migration from <cite>XEP-0090</cite> straightforward. This document specifies a different format for the XML character data of the &lt;utc&gt; element (compliant with <cite>XEP-0082</cite>) and specifies a new &lt;tzo&gt; element for the numeric offset from UTC, while removing the formerly optional and effectively useless &lt;display/&gt; and &lt;tz/&gt; elements.</p>
  <p>Implementations that support <cite>XEP-0090</cite> should support the protocol defined herein as soon as possible, but should continue to support the protocol defined in <cite>XEP-0090</cite> for backwards compatibility until the status of that specification is changed to Obsolete.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
  <p>Revealing an entity's numeric time zone offset may leak limited information about the entity's current location. If the entity's understanding of UTC is far off from actual UTC, revealing that discrepancy may make it possible for an attacker to send XML stanzas that appear to be in the past or future even though they are not; therefore an entity should use the Network Time Protocol (&rfc0958;) or a similar technology to stay synchronized with actual UTC.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
  <p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  <section2 topic='Protocol Namespace' anchor='ns'>
    <p>The &REGISTRAR; includes 'urn:xmpp:time' in its registry of protocol namespaces (see &NAMESPACES;).</p>
  </section2>
</section1>
<section1 topic='XML Schema' anchor='schema'>
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:time'
    xmlns='urn:xmpp:time'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0202: http://www.xmpp.org/extensions/xep-0202.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='time'>
    <xs:complexType>
      <xs:sequence minOccurs='0'>
        <xs:element name='tzo' type='xs:string'/>
        <xs:element name='utc' type='xs:string'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
]]></code>
</section1>
</xep>
