home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_n_r / draft-newman-datetime-00.txt < prev    next >
Text File  |  1996-12-23  |  17KB  |  506 lines

  1.  
  2.  
  3.  
  4.  
  5. Network Working Group                                          C. Newman
  6. Internet Draft: Date and Time on the Internet                   Innosoft
  7. Document: draft-newman-datetime-00.txt                     December 1996
  8.  
  9.  
  10.                      Date and Time on the Internet
  11.  
  12.  
  13. Status of this memo
  14.  
  15.      This document is an Internet Draft.  Internet Drafts are working
  16.      documents of the Internet Engineering Task Force (IETF), its Areas,
  17.      and its Working Groups.  Note that other groups may also distribute
  18.      working documents as Internet Drafts.
  19.  
  20.      Internet Drafts are draft documents valid for a maximum of six
  21.      months.  Internet Drafts may be updated, replaced, or obsoleted by
  22.      other documents at any time.  It is not appropriate to use Internet
  23.      Drafts as reference material or to cite them other than as a
  24.      ``working draft'' or ``work in progress``.
  25.  
  26.      To learn the current status of any Internet-Draft, please check the
  27.      1id-abstracts.txt listing contained in the Internet-Drafts Shadow
  28.      Directories on ds.internic.net, nic.nordu.net, ftp.isi.edu, or
  29.      munnari.oz.au.
  30.  
  31.      A revised version of this draft document will be submitted to the
  32.      IESG as a Proposed Standard for the Internet Community.  Discussion
  33.      and suggestions for improvement are requested.  This document will
  34.      expire six months after publication.  Distribution of this draft is
  35.      unlimited.
  36.  
  37.  
  38.  
  39. 1. Introduction
  40.  
  41.      Date and time formats cause a lot of confusion and interoperability
  42.      problems on the Internet.  This document will address many of the
  43.      problems encountered and make recommendations to improve
  44.      consistancy and interoperability when representing and using date
  45.      and time in Internet protocols.
  46.  
  47.      This document includes an Internet profile of the ISO 8601
  48.      [ISO8601] standard for representation of dates and times.
  49.  
  50.      [More detail work is needed, but I wanted to get this out before I
  51.      go on vacation to see if it meets the basic requirements coming
  52.      from the ASID and CALSCH working groups.  Places needing work are
  53.  
  54.  
  55.  
  56. Newman                                                          [Page 1]
  57.  
  58. Internet Draft               Date and Time                 December 1996
  59.  
  60.  
  61.      marked with XXX]
  62.  
  63.  
  64. 2. Definitions
  65.  
  66.      UTC  Coordinated Universal Time as maintained by the Bureau
  67.           Internaational de l'Heure (International Time Bureau).
  68.  
  69.      [XXX definitely need more definitions here.  It would be nice to
  70.      reference a good time standard to define seconds, leap years, etc.]
  71.  
  72. 3. Two or Three Digit Years
  73.  
  74.      Two digit years are expected to cause great expense to many as the
  75.      year 2000 approaches.  Many existing computer programs simply add
  76.      or subtract 1900 from a two digit year.  Such programs will clearly
  77.      stop functioning on the year 2000 and will have to be upgraded,
  78.      possibly at great expense [XXX - ref to Wall Street Journal article
  79.      on IRS year 2000 problems would be cool].  The following
  80.      requirements are made of Internet protocols to address this
  81.      problem:
  82.  
  83.      o  Internet Protocols MUST generate four digit years in dates.
  84.  
  85.      o  If a two digit year is received, the values 00-49 SHOULD be
  86.      interpreted as referring to the 21st century (add 2000) and the
  87.      values 50-99 SHOULD be interpreted as referring to the 20th century
  88.      (add 1900).
  89.  
  90.      o  Three digit years MUST be interpreted by adding 1900.
  91.  
  92.  
  93. 4. Local Time
  94.  
  95. 4.1. Coordinated Universal Time (UTC)
  96.  
  97.      Because the daylight rules for local timezones are so convoluted
  98.      [XXX-ref], true interoperability is best achieved by using
  99.      Coordinated Universal Time (UTC) [XXX-ref].
  100.  
  101.  
  102. 4.2. Local Offsets
  103.  
  104.      The offset between local time and UTC is often useful information.
  105.      For example, in electronic mail [IMAIL] the local offset provides a
  106.      useful heuristic to determine the probability of a prompt response.
  107.      Attempts to label local offsets with alphabetic strings have met
  108.      with poor interoperability results in the past [IMAIL], [HOST-REQ].
  109.  
  110.  
  111.  
  112. Newman                                                          [Page 2]
  113.  
  114. Internet Draft               Date and Time                 December 1996
  115.  
  116.  
  117.      Therefore numeric offsets are now REQUIRED.  When the local offset
  118.      is unknown, the offset "-00:00" MAY be used to indicate that the
  119.      time is in UTC and the local offset is unknown.
  120.  
  121.  
  122. 4.3. Unqualified Local Time
  123.  
  124.      A number of devices currently connected to the Internet run their
  125.      internal clocks in local time and are unaware of UTC.  While the
  126.      Internet does have a tradition of accepting reality when creating
  127.      specifications, this should not be done at the expense of
  128.      interoperability.  Since interpretation of an unqualified local
  129.      timezone will fail in approximately 23/24 of the globe, the
  130.      interoperability problems of unqualified local time are deemed
  131.      unacceptable for the Internet.  Devices which are unaware of the
  132.      time in UTC MUST use one of the following techniques when
  133.      communicating on the Internet:
  134.  
  135.      o  Use Network Time Protocol [NTP] to obtain the time in UTC.
  136.  
  137.      o  Use another host in the same local timezone as a gateway to the
  138.      Internet.  This host MUST correct unqualified local times before
  139.      they are transmitted to other hosts.
  140.  
  141.      o  Prompt the user for the local timezone if it is aware of the
  142.      daylight rules.  One technique to do this is by having the user
  143.      select a major city in their timezone.  An alternative would be to
  144.      show a list of the timezone labels defined in [section XXX].
  145.  
  146.  
  147. 5. Date and Time formats
  148.  
  149.      The date and time format defined in [IMAIL] and as amended by
  150.      [HOST-REQ] may be referred to as "the Internet Mail Date/Time
  151.      Format".  The profile of ISO 8601 defined in this section may be
  152.      referred to as "the Internet Date/Time Format".  The following
  153.      sections describe useful properties of a date and time format for
  154.      interchange on the Internet.
  155.  
  156.  
  157. 5.1. Ordering
  158.  
  159.      If date and time components are ordered from least precise to most
  160.      precise, then a useful property is achieved.  Assuming that the
  161.      timezones of the dates and times are the same (e.g. all in UTC),
  162.      then the date and time strings may be sorted as strings (e.g. using
  163.      the strcmp() function in C) and a time-ordered sequence will
  164.      result.  The presence of optional punctuation would violate this
  165.  
  166.  
  167.  
  168. Newman                                                          [Page 3]
  169.  
  170. Internet Draft               Date and Time                 December 1996
  171.  
  172.  
  173.      characteristic.
  174.  
  175.  
  176. 5.2. Human Readability
  177.  
  178.      Human readability has proved to be a valuable feature of Internet
  179.      protocols.  Human readable protocols greatly reduce the costs of
  180.      debugging since telnet often suffices as a test client and network
  181.      analysers need not be modified with knowledge of the protocol.  On
  182.      the other hand, human readability sometimes results in
  183.      interoperability problems.  For example, the date format
  184.      "10/11/1996" is completely unsuitable for global interchange
  185.      because it is interpreted differently in different countries.  In
  186.      addition, the date format in [IMAIL] has resulted in
  187.      interoperability problems when people assumed it was simply a text
  188.      string and translated the three letter abbreviations to other
  189.      languages or substituted date formats which were easier to generate
  190.      (e.g. the format used by the C function ctime).  For this reason, a
  191.      balance must be struck between human readability and
  192.      interoperability.
  193.  
  194.      Because no date and time format is readable according to the
  195.      conventions of all countries, Internet clients SHOULD be prepared
  196.      to transform dates into a display format suitable for the locality.
  197.      This includes translating UTC to local time.
  198.  
  199.  
  200. 5.3. Simplicity
  201.  
  202.      The complete set of date and time formats specified in ISO 8601
  203.      [ISO8601] is quite complex in an attempt to provide multiple
  204.      representations and partial representations.  Appendix A contains
  205.      an attempt to translate the complete syntax of ISO 8601 into ABNF
  206.      as defined in [IMAIL].  Internet protocols have somewhat different
  207.      requirements and simplicity has proved to be an important
  208.      characteristic.  In addition, Internet protocols usually need
  209.      complete specification of data in order to achieve true
  210.      interoperability.  Therefore, the complete grammar for ISO 8601 is
  211.      deemed too complex for most Internet protocols.
  212.  
  213.      The following section defines an profile of ISO 8601 for use on the
  214.      Internet.  It is a conformant subset of the ISO 8601 extended
  215.      format.  Simplicity is achieved by making most fields and
  216.      punctuation mandatory.
  217.  
  218.  
  219. 5.4. Internet Date/Time Format
  220.  
  221.  
  222.  
  223.  
  224. Newman                                                          [Page 4]
  225.  
  226. Internet Draft               Date and Time                 December 1996
  227.  
  228.  
  229.      The following profile of ISO 8601 [ISO8601] dates SHOULD be used in
  230.      new protocols on the Internet.  This is specified using ABNF as
  231.      defined in [IMAIL].
  232.  
  233.      date-fullyear   = 4DIGIT
  234.      date-month      = 2DIGIT  ; 01-12
  235.      date-mday       = 2DIGIT  ; 01-28, 01-29, 01-30, 01-31 based on month/year
  236.      time-hour       = 2DIGIT  ; 00-24
  237.      time-minute     = 2DIGIT  ; 00-59
  238.      time-second     = 2DIGIT  ; 00-60
  239.      time-secfrac    = "," 1*DIGIT
  240.      time-numzone    = ("+" / "-") time-hour ":" time-minute
  241.      time-zone       = "Z" / time-numzone
  242.  
  243.      full-date       = date-fullyear "-" date-month "-" date-mday
  244.      full-time       = time-hour ":" time-minute ":" time-second
  245.                        [time-secfrac] time-zone
  246.  
  247.      date-time       = full-date "T" full-time
  248.  
  249.  
  250. 5.5 Examples
  251.  
  252.      Here are two examples of this date and time format.
  253.  
  254.      1985-04-12T23:20:50,5Z
  255.  
  256.      This represents 20 minutes and 50.5 seconds after 11 PM on April
  257.      12th, 1985 in UTC.
  258.  
  259.      1996-12-19T16:39:57-08:00
  260.  
  261.      This represents 39 minutes and 57 seconds after 4 PM on December
  262.      19th, 1996 with an offset of -08:00 from UTC (Pacific Standard
  263.      Time).
  264.  
  265.  
  266. 6. IANA Registry of Timezone Names
  267.  
  268.      [XXX - put good stuff here]
  269.  
  270.  
  271. 7. References
  272.  
  273. [ISO8601] "Data elements and interchange formats -- Information
  274. interchange -- Representation of dates and times", ISO 8601:1988(E),
  275. International Organization for Standardization, June, 1988.
  276.  
  277.  
  278.  
  279.  
  280. Newman                                                          [Page 5]
  281.  
  282. Internet Draft               Date and Time                 December 1996
  283.  
  284.  
  285. [IMAIL] Crocker, D., "Standard for the Format of Arpa Internet Text
  286.  Messages", RFC 822, University of Delaware, August 1982.
  287.  
  288.     <ftp://ds.internic.net/rfc/rfc822.txt>
  289.  
  290. [HOST-REQ] Braden, R., "Requirements for Internet Hosts -- Application
  291.  and Support", RFC 1123, Internet Engineering Task Force, October 1989.
  292.  
  293.     <ftp://ds.internic.net/rfc/rfc1123.txt>
  294.  
  295. [NTP] Mills, D., "Network Time Protocol version 2 specification and
  296.  implementation", RFC 1119, September 1989.
  297.  
  298.     <ftp://ds.internic.net/rfc/rfc1119.ps>
  299.  
  300.  
  301. 8. Security Considerations
  302.  
  303.      Since the local time zone of a site may be useful for determining a
  304.      time when systems are less likely to be monitored and might be more
  305.      susceptible to a security probe, some sites may wish to emit times
  306.      in UTC only.  Others might consider this to be loss of useful
  307.      functionality at the hands of paranoia.
  308.  
  309.  
  310. 9. Author's Address
  311.  
  312. Chris Newman
  313. Innosoft International, Inc.
  314. 1050 East Garvey Ave. South
  315. West Covina, CA 91790 USA
  316.  
  317. Email: chris.newman@innosoft.com
  318.  
  319. APPENDIX
  320.  
  321. A. ISO 8601 Collected ABNF
  322.  
  323.      ISO 8601 does not specify a formal grammar for the date and time
  324.      formats it defines.  The following is an attempt to create a formal
  325.      grammar from ISO 8601.  This is informational only and may contain
  326.      errors.  ISO 8601 remains the authoratative reference for the
  327.      complete syntax.
  328.  
  329.      date-century      = 2DIGIT  ; 00-99
  330.      date-decade       =  DIGIT  ; 0-9
  331.      date-subdecade    =  DIGIT  ; 0-9
  332.      date-year         = date-decade date-subdecade
  333.  
  334.  
  335.  
  336. Newman                                                          [Page 6]
  337.  
  338. Internet Draft               Date and Time                 December 1996
  339.  
  340.  
  341.      date-fullyear     = date-century date-year
  342.      date-month        = 2DIGIT  ; 01-12
  343.      date-wday         =  DIGIT  ; 1-7  ; 1 is Monday, 7 is Sunday
  344.      date-mday         = 2DIGIT  ; 01-28, 01-29, 01-30, 01-31 based on month/year
  345.      date-yday         = 3DIGIT  ; 001-365, 001-366 based on year
  346.      date-week         = 2DIGIT  ; 01-52, 01-53 based on year
  347.  
  348.      datepart-fullyear = [date-century] date-year ["-"]
  349.      datepart-ptyear   = "-" [date-subdecade ["-"]]
  350.      datepart-wkyear   = datepart-ptyear / datepart-fullyear
  351.  
  352.      dateopt-century   = "-" / date-century
  353.      dateopt-fullyear  = "-" / datepart-fullyear
  354.      dateopt-year      = "-" / (date-year ["-"])
  355.      dateopt-month     = "-" / (date-month ["-"])
  356.      dateopt-week      = "-" / (date-week ["-"])
  357.  
  358.      datespec-full     = datepart-fullyear date-month ["-"] date-mday
  359.      datespec-year     = date-century / dateopt-century date-year
  360.      datespec-month    = "-" dateopt-year date-month [["-"] date-mday]
  361.      datespec-mday     = "--" dateopt-month date-mday
  362.      datespec-week     = datepart-wkyear "W" (date-week / dateopt-week date-wday)
  363.      datespec-wday     = "---" date-wday
  364.      datespec-yday     = dateopt-fullyear date-yday
  365.  
  366.      date              = datespec-full / datespec-year / datespec-month /
  367.           datespec-mday / datespec-week / datespec-wday / datespec-yday
  368.  
  369.      Time:
  370.  
  371.      time-hour         = 2DIGIT ; 00-24
  372.      time-minute       = 2DIGIT ; 00-59
  373.      time-second       = 2DIGIT ; 00-60
  374.      time-fraction     = ("," / ".") 1*DIGIT
  375.      time-numzone      = ("+" / "-") time-hour [[":"] time-minute]
  376.      time-zone         = "Z" / time-numzone
  377.  
  378.      timeopt-hour      = "-" / (time-hour [":"])
  379.      timeopt-minute    = "-" / (time-minute [":"])
  380.  
  381.      timespec-hour     = time-hour [[":"] time-minute [[":"] time-second]]
  382.      timespec-minute   = timeopt-hour time-minute [[":"] time-second]
  383.      timespec-second   = "-" timeopt-minute time-second
  384.      timespec-base     = timespec-hour / timespec-minute / timespec-second
  385.  
  386.      time              = timespec-base [time-fraction] [time-zone]
  387.  
  388.      iso-date-time     = date "T" time
  389.  
  390.  
  391.  
  392. Newman                                                          [Page 7]
  393.  
  394. Internet Draft               Date and Time                 December 1996
  395.  
  396.  
  397.      Durations (periods):
  398.  
  399.      dur-second        = 1*DIGIT "S" dur-minute        = 1*DIGIT "M"
  400.      [dur-second] dur-hour          = 1*DIGIT "H" [dur-minute] dur-time
  401.      = "T" (dur-hour / dur-minute / dur-second) dur-day           =
  402.      1*DIGIT "D" dur-week          = 1*DIGIT "W" dur-month         =
  403.      1*DIGIT "M" [dur-day] dur-year          = 1*DIGIT "Y" [dur-month]
  404.      dur-date          = (dur-day / dur-month / dur-year) [dur-time]
  405.  
  406.      duration          = "P" (dur-date / dur-time / dur-week)
  407.  
  408.      Periods:
  409.  
  410.      period-explicit   = date-time "/" date-time period-start      =
  411.      date-time "/" duration period-end        = duration "/" date-time
  412.  
  413.      period            = period-explicit / period-start / period-end
  414.  
  415.  
  416. B. Zeller's Congruence [XXX-ref]
  417.  
  418.      The following is sample C code which may be used to obtain the day
  419.      of the week:
  420.  
  421.      char *dayofweek[] = {
  422.          "Sunday", "Monday", "Tuesday", "Wednesday",
  423.          "Thursday", "Friday", "Saturday"
  424.      };
  425.  
  426.      void main()
  427.      {
  428.          int cent, year, day, month;
  429.  
  430.          printf("Enter the year (4 digits): ");
  431.          scanf("%d", &year);
  432.          printf("\nEnter the month (1-12): ");
  433.          scanf("%d", &month);
  434.          printf("\nEnter the day of the month (1-31): ");
  435.          scanf("%d", &day);
  436.          month -= 2;
  437.          if (month < 1) {
  438.              month += 12;
  439.              year--;
  440.          }
  441.          cent = year / 100;
  442.          year %= 100;
  443.          printf("The day of the week is: %s\n",
  444.                 dayofweek[((26 * month - 2) / 10 + day + year
  445.  
  446.  
  447.  
  448. Newman                                                          [Page 8]
  449.  
  450. Internet Draft               Date and Time                 December 1996
  451.  
  452.  
  453.                            + year / 4 + cent / 4 - 2 * cent) % 7]);
  454.      }
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504. Newman                                                          [Page 9]
  505.  
  506.