Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/time Import tzcode2009k.



details:   https://anonhg.NetBSD.org/src/rev/20e8202bf611
branches:  trunk
changeset: 750445:20e8202bf611
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Thu Dec 31 22:49:15 2009 +0000

description:
Import tzcode2009k.
- now understands 64bit time_t and 64bit data in timezone files.
- localtime(), gmtime(), asctime() and ctime() may now fail with
  a NULL result if time_t cannot be represented by struct tm.

diffstat:

 lib/libc/time/README       |    14 +-
 lib/libc/time/Theory       |   115 ++-
 lib/libc/time/asctime.c    |   102 +++-
 lib/libc/time/checktab.awk |     6 +-
 lib/libc/time/ctime.3      |    97 ++-
 lib/libc/time/difftime.c   |   119 +--
 lib/libc/time/ialloc.c     |    17 +-
 lib/libc/time/localtime.c  |  1032 +++++++++++++++++++++++++++------------
 lib/libc/time/private.h    |   194 +++---
 lib/libc/time/scheck.c     |    19 +-
 lib/libc/time/strftime.c   |   238 +++++++-
 lib/libc/time/time2posix.3 |     4 +-
 lib/libc/time/tz-link.htm  |   605 +++++++++++++++-------
 lib/libc/time/tzfile.5     |    24 +-
 lib/libc/time/tzfile.h     |    64 +-
 lib/libc/time/tzselect.8   |     6 +-
 lib/libc/time/tzselect.ksh |    21 +-
 lib/libc/time/tzset.3      |     6 +-
 lib/libc/time/zdump.8      |    23 +-
 lib/libc/time/zdump.c      |   534 ++++++++++++++++----
 lib/libc/time/zic.8        |   103 +++-
 lib/libc/time/zic.c        |  1159 +++++++++++++++++++++++++++++++------------
 22 files changed, 3141 insertions(+), 1361 deletions(-)

diffs (truncated from 7124 to 300 lines):

diff -r 72549f8bc722 -r 20e8202bf611 lib/libc/time/README
--- a/lib/libc/time/README      Thu Dec 31 20:14:19 2009 +0000
+++ b/lib/libc/time/README      Thu Dec 31 22:49:15 2009 +0000
@@ -1,4 +1,6 @@
-@(#)README     7.11
+@(#)README     8.3
+This file is in the public domain, so clarified as of
+2009-05-17 by Arthur David Olson.
 
 "What time is it?" -- Richard Deacon as The King
 "Any time you want it to be." -- Frank Baxter as The Scientist
@@ -52,8 +54,10 @@
 
 To use the new functions, use a "-ltz" option when compiling or linking.
 
-Historical local time information has been included here not because it
-is particularly useful, but rather to:
+Historical local time information has been included here to:
+
+*      provide a compendium of data about the history of civil time
+       that is useful even if the data are not 100% accurate;
 
 *      give an idea of the variety of local time rules that have
        existed in the past and thus an idea of the variety that may be
@@ -63,7 +67,9 @@
        system.
 
 The information in the time zone data files is by no means authoritative;
-if you know that the rules are different from those in a file, by all means
+the files currently do not even attempt to cover all time stamps before
+1970, and there are undoubtedly errors even for time stamps since 1970.
+If you know that the rules are different from those in a file, by all means
 feel free to change file (and please send the changed version to
 tz%elsie.nci.nih.gov@localhost for use in the future).  Europeans take note!
 
diff -r 72549f8bc722 -r 20e8202bf611 lib/libc/time/Theory
--- a/lib/libc/time/Theory      Thu Dec 31 20:14:19 2009 +0000
+++ b/lib/libc/time/Theory      Thu Dec 31 22:49:15 2009 +0000
@@ -1,6 +1,7 @@
-#      $NetBSD: Theory,v 1.8 2004/05/27 20:39:49 kleink Exp $
-@(#)Theory     7.15
-
+#      $NetBSD: Theory,v 1.9 2009/12/31 22:49:15 mlelstv Exp $
+@(#)Theory     8.3
+This file is in the public domain, so clarified as of
+2009-05-17 by Arthur David Olson.
 
 ----- Outline -----
 
@@ -10,29 +11,29 @@
        Calendrical issues
        Time and time zones on Mars
 
-
 ----- Time and date functions -----
 
-These time and date functions are upwards compatible with POSIX.1,
+These time and date functions are upwards compatible with POSIX,
 an international standard for UNIX-like systems.
-As of this writing, the current edition of POSIX.1 is:
+As of this writing, the current edition of POSIX is:
 
-  Information technology --Portable Operating System Interface (POSIX (R))
-  -- Part 1: System Application Program Interface (API) [C Language]
-  ISO/IEC 9945-1:1996
-  ANSI/IEEE Std 1003.1, 1996 Edition
-  1996-07-12
+  Standard for Information technology
+  -- Portable Operating System Interface (POSIX (R))
+  -- System Interfaces
+  IEEE Std 1003.1, 2004 Edition
+  <http://www.opengroup.org/online-pubs?DOC=7999959899>
+  <http://www.opengroup.org/pubs/catalog/t041.htm>
 
-POSIX.1 has the following properties and limitations.
+POSIX has the following properties and limitations.
 
-*      In POSIX.1, time display in a process is controlled by the
-       environment variable TZ.  Unfortunately, the POSIX.1 TZ string takes
+*      In POSIX, time display in a process is controlled by the
+       environment variable TZ.  Unfortunately, the POSIX TZ string takes
        a form that is hard to describe and is error-prone in practice.
-       Also, POSIX.1 TZ strings can't deal with other (for example, Israeli)
+       Also, POSIX TZ strings can't deal with other (for example, Israeli)
        daylight saving time rules, or situations where more than two
        time zone abbreviations are used in an area.
 
-       The POSIX.1 TZ string takes the following form:
+       The POSIX TZ string takes the following form:
 
                stdoffset[dst[offset],date[/time],date[/time]]
 
@@ -41,6 +42,9 @@
        std and dst
                are 3 or more characters specifying the standard
                and daylight saving time (DST) zone names.
+               Starting with POSIX.1-2001, std and dst may also be
+               in a quoted form like "<UTC+10>"; this allows
+               "+" and "-" in the names.
        offset
                is of the form `[-]hh:[mm[:ss]]' and specifies the
                offset west of UTC.  The default DST offset is one hour
@@ -63,14 +67,25 @@
                        and `5' stands for the last week in which day d appears
                        (which may be either the 4th or 5th week).
 
-*      In POSIX.1, when a TZ value like "EST5EDT" is parsed,
-       typically the current US DST rules are used,
+       Here is an example POSIX TZ string, for US Pacific time using rules
+       appropriate from 1987 through 2006:
+
+               TZ='PST8PDT,M4.1.0/02:00,M10.5.0/02:00'
+
+       This POSIX TZ string is hard to remember, and mishandles time stamps
+       before 1987 and after 2006.  With this package you can use this
+       instead:
+
+               TZ='America/Los_Angeles'
+
+*      POSIX does not define the exact meaning of TZ values like "EST5EDT".
+       Typically the current US DST rules are used to interpret such values,
        but this means that the US DST rules are compiled into each program
        that does time conversion.  This means that when US time conversion
        rules change (as in the United States in 1987), all programs that
        do time conversion must be recompiled to ensure proper results.
 
-*      In POSIX.1, there's no tamper-proof way for a process to learn the
+*      In POSIX, there's no tamper-proof way for a process to learn the
        system's best idea of local wall clock.  (This is important for
        applications that an administrator wants used only at certain times--
        without regard to whether the user has fiddled the "TZ" environment
@@ -79,9 +94,9 @@
        daylight saving time shifts--as might be required to limit phone
        calls to off-peak hours.)
 
-*      POSIX.1 requires that systems ignore leap seconds.
+*      POSIX requires that systems ignore leap seconds.
 
-These are the extensions that have been made to the POSIX.1 functions:
+These are the extensions that have been made to the POSIX functions:
 
 *      The "TZ" environment variable is used in generating the name of a file
        from which time zone information is read (or is interpreted a la
@@ -109,7 +124,7 @@
 *      To handle places where more than two time zone abbreviations are used,
        the functions "localtime" and "gmtime" set tzname[tmp->tm_isdst]
        (where "tmp" is the value the function returns) to the time zone
-       abbreviation to be used.  This differs from POSIX.1, where the elements
+       abbreviation to be used.  This differs from POSIX, where the elements
        of tzname are only changed as a result of calls to tzset.
 
 *      Since the "TZ" environment variable can now be used to control time
@@ -132,8 +147,7 @@
        environment variable; portable applications should not, however, rely
        on this behavior since it's not the way SVR2 systems behave.)
 
-*      These functions can account for leap seconds, thanks to Bradley White
-       (bww%k.cs.cmu.edu@localhost).
+*      These functions can account for leap seconds, thanks to Bradley White.
 
 Points of interest to folks with other systems:
 
@@ -174,9 +188,9 @@
 beyond those provided here.  The absence of such functions from this package
 is not meant to discourage the development, standardization, or use of such
 functions.  Rather, their absence reflects the decision to make this package
-contain valid extensions to POSIX.1, to ensure its broad
-acceptability.  If more powerful time conversion functions can be standardized,
-so much the better.
+contain valid extensions to POSIX, to ensure its broad acceptability.  If
+more powerful time conversion functions can be standardized, so much the
+better.
 
 
 ----- Names of time zone rule files -----
@@ -229,6 +243,8 @@
        Include at least one location per time zone rule set per country.
                One such location is enough.  Use ISO 3166 (see the file
                iso3166.tab) to help decide whether something is a country.
+               However, uninhabited ISO 3166 regions like Bouvet Island
+               do not need locations, since local time is not defined there.
        If all the clocks in a country's region have agreed since 1970,
                don't bother to include more than one location
                even if subregions' clocks disagreed before 1970.
@@ -264,7 +280,8 @@
        If a name is changed, put its old spelling in the `backward' file.
 
 The file `zone.tab' lists the geographical locations used to name
-time zone rule files.
+time zone rule files.  It is intended to be an exhaustive list
+of canonical names for geographic regions.
 
 Older versions of this package used a different naming scheme,
 and these older names are still supported.
@@ -278,7 +295,7 @@
 ----- Time zone abbreviations -----
 
 When this package is installed, it generates time zone abbreviations
-like `EST' to be compatible with human tradition and POSIX.1.
+like `EST' to be compatible with human tradition and POSIX.
 Here are the general rules used for choosing time zone abbreviations,
 in decreasing order of importance:
 
@@ -293,17 +310,16 @@
                preferred "ChST", so the rule has been relaxed.
 
                This rule guarantees that all abbreviations could have
-               been specified by a POSIX.1 TZ string.  POSIX.1
+               been specified by a POSIX TZ string.  POSIX
                requires at least three characters for an
-               abbreviation.  POSIX.1-1996 says that an abbreviation
+               abbreviation.  POSIX through 2000 says that an abbreviation
                cannot start with ':', and cannot contain ',', '-',
-               '+', NUL, or a digit.  Draft 7 of POSIX 1003.1-200x
-               changes this rule to say that an abbreviation can
-               contain only '-', '+', and alphanumeric characters in
-               the current locale.  To be portable to both sets of
+               '+', NUL, or a digit.  POSIX from 2001 on changes this
+               rule to say that an abbreviation can contain only '-', '+',
+               and alphanumeric characters from the portable character set
+               in the current locale.  To be portable to both sets of
                rules, an abbreviation must therefore use only ASCII
-               letters, as these are the only letters that are
-               alphabetic in all locales.
+               letters.
 
        Use abbreviations that are in common use among English-speakers,
                e.g. `EST' for Eastern Standard Time in North America.
@@ -329,8 +345,9 @@
                        and then append `T', `ST', etc. as before;
                        e.g. `VLAST' for VLAdivostok Summer Time.
 
-       Use "zzz" for locations while uninhabited.  The mnemonic is that
-               these locations are, in some sense, asleep.
+       Use UTC (with time zone abbreviation "zzz") for locations while
+               uninhabited.  The "zzz" mnemonic is that these locations are,
+               in some sense, asleep.
 
 Application writers should note that these abbreviations are ambiguous
 in practice: e.g. `EST' has a different meaning in Australia than
@@ -344,10 +361,10 @@
 Calendrical issues are a bit out of scope for a time zone database,
 but they indicate the sort of problems that we would run into if we
 extended the time zone database further into the past.  An excellent
-resource in this area is Nachum Dershowitz and Edward M. Reingold,
-<a href="http://emr.cs.uiuc.edu/home/reingold/calendar-book/index.shtml";>
-Calendrical Calculations
-</a>, Cambridge University Press (1997).  Other information and
+resource in this area is Edward M. Reingold and Nachum Dershowitz,
+<a href="http://emr.cs.uiuc.edu/home/reingold/calendar-book/second-edition/";>
+Calendrical Calculations: The Millennium Edition
+</a>, Cambridge University Press (2001).  Other information and
 sources are given below.  They sometimes disagree.
 
 
@@ -360,7 +377,7 @@
 
 Russia
 
-From Chris Carrier <72157.3334%CompuServe.COM@localhost> (1996-12-02):
+From Chris Carrier (1996-12-02):
 On 1929-10-01 the Soviet Union instituted an ``Eternal Calendar''
 with 30-day months plus 5 holidays, with a 5-day week.
 On 1931-12-01 it changed to a 6-day week; in 1934 it reverted to the
@@ -375,7 +392,7 @@
 
 From: Petteri Sulonen (via Usenet)
 Date: 14 Jan 1999 00:00:00 GMT
-Message-ID: <Petteri.Sulonen-1401991626030001%lapin-kulta.in.helsinki.fi@localhost>
+...
 
 If your source is correct, how come documents between 1929 -- 1940 were
 still dated using the conventional, Gregorian calendar?
@@ -388,7 +405,7 @@
 
 Sweden (and Finland)
 
-From: msb%sq.com@localhost (Mark Brader)
+From: Mark Brader
 <a href="news:1996Jul6.012937.29190%sq.com@localhost";>
 Subject: Re: Gregorian reform -- a part of locale?
 </a>
@@ -416,11 +433,11 @@
 
 Grotefend's data
 
-From: "Michael Palmer" <mpalmer%netcom.com@localhost> [with one obvious typo fixed]
+From: "Michael Palmer" [with one obvious typo fixed]
 Subject: Re: Gregorian Calendar (was Re: Another FHC related question
 Newsgroups: soc.genealogy.german
 Date: Tue, 9 Feb 1999 02:32:48 -800
-Message-ID: <199902091032.CAA09644%netcom10.netcom.com@localhost>
+...
 
 The following is a(n incomplete) listing, arranged chronologically, of
 European states, with the date they converted from the Julian to the
@@ -547,7 +564,7 @@
 
 Michael Allison and Robert Schmunk,
 "Technical Notes on Mars Solar Time as Adopted by the Mars24 Sunclock"



Home | Main Index | Thread Index | Old Index