<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="lib/rfc2629.xslt"?>
<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes"?>
<?rfc subcompact="no" ?>
<?rfc linkmailto="no" ?>
<?rfc editing="no" ?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc-ext allow-markup-in-artwork="yes" ?>
<?rfc-ext include-index="no" ?>

<rfc ipr="trust200902"
     category="exp"
     docName="draft-thierry-bulk-time-00"
     xmlns:x="http://purl.org/net/xml2rfc/ext">
  <x:feedback template="mailto:pierre@nothos.net"/>
  <front>
    <title abbrev="BULK-Time">BULK Time namespace</title>

    <author initials="P." surname="Thierry" fullname="Pierre Thierry">
      <organization>Thierry Technologies</organization>
      <address>
        <email>pierre@nothos.net</email>
      </address>
    </author>

    <date day="7" month="August" year="2013" />
    <keyword>binary</keyword>

    <abstract>
      <t>
        This specification describes a BULK serialization of time informations.
      </t>
    </abstract>

  </front>

  <middle>
    <section anchor="intro" title="Introduction">
      <section title="Conventions and 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">RFC 2119</xref>.
        </t>
        <t>
          Literal numerical values are provided in decimal or hexadecimal as appropriate.
          Hexadecimal literals are prefixed with <spanx style="verb">0x</spanx> to distinguish them
          from decimal literals.
        </t>
	<t>
	  BULK bytes sequences and expressions are described with the same conventions than used in
	  the <xref target="BULK1">BULK 1.0 specification</xref>
	</t>
      </section>
    </section>

    <section title="BULK Time namespace">
      <t>
	The time namespace is an official namespace identified by the UUID <eref
	target="urn:uuid:a0236aea-9923-511d-b755-66be75151201"/> (BULK, "Time passed, which,
	basically, is its job."). It provides a standard way to serialize some formats used to
	express time, mainly those from <xref target="ISO8601">ISO 8601</xref>.
      </t>

      <section title="Types">
	<t>This specification defines the following types:</t>
	<list style="hanging">
	  <t hangText="Int123">a sequence of type <spanx style="verb">Int</spanx>, <spanx
	  style="verb">Int Int</spanx> or <spanx style="verb">Int Int Int</spanx></t>
	  <t hangText="IntsF">a sequnce of one or more expressions, all of which MUST be of type
	  <spanx style="verb">Int</spanx>, except the last which can also be of type <spanx
	  style="verb">Float</spanx></t>
	</list>
      </section>

      <section title="ISO 8601">
	<t>
	  Note that BULK serializations of single points in time are notably bigger than a string
	  containing their ISO 8601 notation. Such times SHOULD be serialized as offsets against an
	  epoch (like Julian date or Unix time), except where simplicity of implementation is
	  wanted.
	</t>
	<section title="Calendar date">
	  <t>
	    <list style="hanging">
	      <t hangText="name"><spanx style="verb">0x1</spanx> (mnemonic: <spanx
	      style="verb">calendar</spanx> )</t>
	      <t hangText="shape"><spanx style="verb">( calendar Int123 )</spanx></t>
	    </list>
	  </t>
	  <t>
	    This serialize dates like 1999, 2001-06 or 2013-08-06.
	  </t>
	  <t>Types: <spanx style="verb">ISOTime</spanx>, <spanx style="verb">Date</spanx></t>
	</section>

	<section title="Week date">
	  <t>
	    <list style="hanging">
	      <t hangText="name"><spanx style="verb">0x2</spanx> (mnemonic: <spanx
	      style="verb">weekdate</spanx> )</t>
	      <t hangText="shape"><spanx style="verb">( weekdate Int123 )</spanx></t>
	    </list>
	  </t>
	  <t>
	    This serialize dates like 1979, 1987-W06 or 2012-W52-1.
	  </t>
	  <t>Types: <spanx style="verb">ISOTime</spanx>, <spanx style="verb">Date</spanx></t>
	</section>

	<section title="Ordinale date">
	  <t>
	    <list style="hanging">
	      <t hangText="name"><spanx style="verb">0x3</spanx> (mnemonic: <spanx
	      style="verb">ordinal</spanx> )</t>
	      <t hangText="shape"><spanx style="verb">( ordinal Int Int )</spanx></t>
	    </list>
	  </t>
	  <t>
	    This serialize dates like 2004-006 or 2000-366.
	  </t>
	  <t>Types: <spanx style="verb">ISOTime</spanx>, <spanx style="verb">Date</spanx></t>
	</section>

	<section title="Time of day">
	  <t>
	    <list style="hanging">
	      <t hangText="name"><spanx style="verb">0x4</spanx> (mnemonic: <spanx
	      style="verb">time-of-day</spanx> )</t>
	      <t hangText="shape"><spanx style="verb">( time-of-day {components}:IntsF )</spanx></t>
	    </list>
	  </t>
	  <t>
	    This serialize times like 22, 13:45 or 06:34:57,3. {components} MUST contain from 1 to 3
	    expressions.
	  </t>
	  <t>Types: <spanx style="verb">ISOTime</spanx>, <spanx style="verb">ISOTimeOfDay</spanx></t>
	</section>

	<section title="Point in time">
	  <t>
	    <list style="hanging">
	      <t hangText="name"><spanx style="verb">0x5</spanx> (mnemonic: <spanx
	      style="verb">point</spanx> )</t>
	      <t hangText="shape"><spanx style="verb">( point Date ISOTimeOfDay )</spanx></t>
	    </list>
	  </t>
	  <t>
	    This serialize dates like 2005-W34-7T19:45.
	  </t>
	  <t>Type: <spanx style="verb">ISOTime</spanx></t>
	</section>

	<section title="UTC time">
	  <t>
	    <list style="hanging">
	      <t hangText="name"><spanx style="verb">0x6</spanx> (mnemonic: <spanx
	      style="verb">zulu</spanx> )</t>
	      <t hangText="shape"><spanx style="verb">( zulu ISOTime )</spanx></t>
	    </list>
	  </t>
	  <t>
	    This serialize times like 2005-W34-7T19:45Z or 11:53:23Z.
	  </t>
	  <t>Type: <spanx style="verb">ISOTime</spanx></t>
	</section>

	<section title="Offset time">
	  <t>
	    <list style="hanging">
	      <t hangText="name"><spanx style="verb">0x7</spanx> (mnemonic: <spanx
	      style="verb">offset</spanx> )</t>
	      <t hangText="shape"><spanx style="verb">( offset ISOTimeOfDay ISOTime )</spanx></t>
	    </list>
	  </t>
	  <t>
	    This serialize times like 2005-W34-7T19:45+02 or 11:53-01:30.
	  </t>
	  <t>Type: <spanx style="verb">ISOTime</spanx></t>
	</section>

	<section title="Durations">
	  <t>
	    <list style="hanging">
	      <t hangText="0x8"><spanx style="verb">years</spanx></t>
	      <t hangText="0x9"><spanx style="verb">months</spanx></t>
	      <t hangText="0xA"><spanx style="verb">days</spanx></t>
	      <t hangText="0xB"><spanx style="verb">hours</spanx></t>
	      <t hangText="0xC"><spanx style="verb">minutes</spanx></t>
	      <t hangText="0xD"><spanx style="verb">seconds</spanx></t>
	      <t hangText="0xE"><spanx style="verb">weeks</spanx></t>
	    </list>
	  </t>
	  <t>
	    All durations have the same shape: <spanx style="verb">( Ref {components}:IntsF
	    )</spanx>. { components} must contain from 1 to respectively 6, 5, 4, 3, 2, 1 and 1
	    expressions.
	  </t>
	  <t>Type: <spanx style="verb">ISODuration</spanx></t>
	</section>

	<section title="Interval">
	  <t>
	    <list style="hanging">
	      <t hangText="name"><spanx style="verb">0xF</spanx> (mnemonic: <spanx
	      style="verb">interval</spanx> )</t>
	      <t hangText="shape"><spanx style="verb">( interval ISOTime ISOTime )</spanx></t>
	      <t hangText="shape"><spanx style="verb">( interval ISOTime ISODuration )</spanx></t>
	      <t hangText="shape"><spanx style="verb">( interval ISODuration ISOTime )</spanx></t>
	      <t hangText="shape"><spanx style="verb">( interval ISODuration )</spanx></t>
	    </list>
	  </t>
	  <t>Type: <spanx style="verb">Interval</spanx></t>
	</section>

	<section title="Repeating intervals">
	  <t>
	    <list style="hanging">
	      <t hangText="name"><spanx style="verb">0x10</spanx> (mnemonic: <spanx
	      style="verb">repeat</spanx> )</t>
	      <t hangText="shape"><spanx style="verb">( interval Int Interval )</spanx></t>
	      <t hangText="shape"><spanx style="verb">( interval Interval )</spanx></t>
	    </list>
	  </t>
	</section>

      </section>

      <section title="Julian date">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x11</spanx> (mnemonic: <spanx
	    style="verb">julian</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( julian {num}:Number )</spanx></t>
	  </list>
	</t>
	<t>
	  It serializes the Julian Day Number (if {num} has type Int) or the Julian Date (if {num}
	  has type Float).
	</t>
      </section>

      <section title="Unix time">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x12</spanx> (mnemonic: <spanx
	    style="verb">unix-time</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( unix-time Number )</spanx></t>
	  </list>
	</t>
	<t>
	  It serializes the number of seconds since or until the Unix epoch (with microsecond or
	  nanosecond precision if the number has type Float).
	</t>
      </section>

      <section title="Star Trek TNG stardate">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x13</spanx> (mnemonic: <spanx
	    style="verb">tng-stardate</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( tng-stardate Int Int )</spanx></t>
	  </list>
	</t>
	<t>
	  It serializes a stardate following the conventions of Star Trek: The Next Generation and
	  following series.
	</t>
      </section>

      <section title="Anno Mundi">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x14</spanx> (mnemonic: <spanx
	    style="verb">anno-mundi</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( anno-mundi Int123 )</spanx></t>
	  </list>
	</t>
	<t>
	  It serializes a date in the hebrew calendar.
	</t>
      </section>

      <section title="Anno Hegirae">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x15</spanx> (mnemonic: <spanx
	    style="verb">anno-hegirae</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( anno-hegirae Int123 )</spanx></t>
	  </list>
	</t>
	<t>
	  It serializes a date in the islamic calendar.
	</t>
      </section>

    </section>

    <section title="Security Considerations" anchor="sec">
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <reference anchor="RFC2119">
        <front>
          <title>
            Key words for use in RFCs to Indicate Requirement Levels
          </title>
          <author initials="S." surname="Bradner" fullname="Scott Bradner">
            <organization>Harvard University</organization>
            <address><email>sob@harvard.edu</email></address>
          </author>
          <date month="March" year="1997"/>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
      </reference>

      <reference anchor="BULK1">
	<front>
	  <title>Binary Uniform Language Kit 1.0</title>
	  <date day="7" month="August" year="2013"/>
	  <author initials="P." surname="Thierry" fullname="Pierre Thierry">
	    <organization>Thierry Technologies</organization>
	    <address>
	      <email>pierre@nothos.net</email>
	    </address>
	  </author>
	</front>
	<seriesInfo name="Internet-Draft" value="draft-thierry-bulk-02"/>
      </reference>

    </references>


    <references title="Informative references">
      <reference anchor="ISO8601">
	<front>
	  <title>ISO 8601:2004 Data elements and interchange formats -- Information interchange -- Representation
	  of dates and times</title>
	  <date year="2004"/>
	</front>
      </reference>
    </references>

  </back>
</rfc>

