<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<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>
  
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<permissions>Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.</permissions>
<warranty>## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##</warranty>
<liability>In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.</liability>
<conformance>This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
  <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>
  
  <author>
    <firstname>Peter</firstname>
    <surname>Saint-Andre</surname>
    <email>stpeter@stpeter.im</email>
    <jid>stpeter@jabber.org</jid>
    <uri>https://stpeter.im/</uri>
  </author>

  <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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0090.html">Legacy Entity Time (XEP-0090)</link></span> <note>XEP-0090: Legacy Entity Time &lt;<link url="https://xmpp.org/extensions/xep-0090.html">https://xmpp.org/extensions/xep-0090.html</link>&gt;.</note> 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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0090.html">Legacy Entity Time (XEP-0090)</link></span> <note>XEP-0090: Legacy Entity Time &lt;<link url="https://xmpp.org/extensions/xep-0090.html">https://xmpp.org/extensions/xep-0090.html</link>&gt;.</note> 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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0090.html">Legacy Entity Time (XEP-0090)</link></span> <note>XEP-0090: Legacy Entity Time &lt;<link url="https://xmpp.org/extensions/xep-0090.html">https://xmpp.org/extensions/xep-0090.html</link>&gt;.</note> (first developed in 1999 or 2000) is not consistent with the recommended date and time profiles for XMPP protocols defined in <span class="ref"><link url="https://xmpp.org/extensions/xep-0082.html">XMPP Date and Time Profiles (XEP-0082)</link></span> <note>XEP-0082: XMPP Date and Time Profiles &lt;<link url="https://xmpp.org/extensions/xep-0082.html">https://xmpp.org/extensions/xep-0082.html</link>&gt;.</note> (written in 2003).</p></li>
  </ul>
  <p>To overcome these limitations, this document defines a replacement for <span class="ref"><link url="https://xmpp.org/extensions/xep-0090.html">Legacy Entity Time (XEP-0090)</link></span> <note>XEP-0090: Legacy Entity Time &lt;<link url="https://xmpp.org/extensions/xep-0090.html">https://xmpp.org/extensions/xep-0090.html</link>&gt;.</note> 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 &lt;iq/&gt; 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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0082.html">XMPP Date and Time Profiles (XEP-0082)</link></span> <note>XEP-0082: XMPP Date and Time Profiles &lt;<link url="https://xmpp.org/extensions/xep-0082.html">https://xmpp.org/extensions/xep-0082.html</link>&gt;.</note>.</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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0082.html">XMPP Date and Time Profiles (XEP-0082)</link></span> <note>XEP-0082: XMPP Date and Time Profiles &lt;<link url="https://xmpp.org/extensions/xep-0082.html">https://xmpp.org/extensions/xep-0082.html</link>&gt;.</note> 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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0086.html">Error Condition Mappings (XEP-0086)</link></span> <note>XEP-0086: Error Condition Mappings &lt;<link url="https://xmpp.org/extensions/xep-0086.html">https://xmpp.org/extensions/xep-0086.html</link>&gt;.</note> apply (e.g., &lt;service-unavailable/&gt; 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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0030.html">Service Discovery (XEP-0030)</link></span> <note>XEP-0030: Service Discovery &lt;<link url="https://xmpp.org/extensions/xep-0030.html">https://xmpp.org/extensions/xep-0030.html</link>&gt;.</note> 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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0090.html">Legacy Entity Time (XEP-0090)</link></span> <note>XEP-0090: Legacy Entity Time &lt;<link url="https://xmpp.org/extensions/xep-0090.html">https://xmpp.org/extensions/xep-0090.html</link>&gt;.</note> 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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0090.html">Legacy Entity Time (XEP-0090)</link></span> <note>XEP-0090: Legacy Entity Time &lt;<link url="https://xmpp.org/extensions/xep-0090.html">https://xmpp.org/extensions/xep-0090.html</link>&gt;.</note> 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 (<span class="ref"><link url="http://tools.ietf.org/html/rfc0958">RFC 958</link></span> <note>RFC 958: Network Time Protocol (NTP) &lt;<link url="http://tools.ietf.org/html/rfc0958">http://tools.ietf.org/html/rfc0958</link>&gt;.</note>) 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 the <span class="ref"><link url="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</link></span> <note>The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see &lt;<link url="http://www.iana.org/">http://www.iana.org/</link>&gt;.</note>.</p>
</section1>
<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <section2 topic="Protocol Namespace" anchor="ns">
    <p>The <span class="ref"><link url="https://xmpp.org/registrar/">XMPP Registrar</link></span> <note>The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see &lt;<link url="https://xmpp.org/registrar/">https://xmpp.org/registrar/</link>&gt;.</note> includes 'urn:xmpp:time' in its registry of protocol namespaces (see &lt;<link url="https://xmpp.org/registrar/namespaces.html">https://xmpp.org/registrar/namespaces.html</link>&gt;).</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>
