~ubuntu-branches/ubuntu/trusty/postgresql-8.4/trusty

« back to all changes in this revision

Viewing changes to src/timezone/pgtz.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
7
7
 *
8
8
 * IDENTIFICATION
9
 
 *        $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.62 2009/01/01 17:24:04 momjian Exp $
 
9
 *        $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.63 2009/06/11 14:49:15 momjian Exp $
10
10
 *
11
11
 *-------------------------------------------------------------------------
12
12
 */
387
387
         * enough to identify DST transition rules, since everybody switches on
388
388
         * Sundays.)  This is sufficient to cover most of the Unix time_t range,
389
389
         * and we don't want to look further than that since many systems won't
390
 
         * have sane TZ behavior further back anyway.  The further
391
 
         * back the zone matches, the better we score it.  This may seem like a
392
 
         * rather random way of doing things, but experience has shown that
393
 
         * system-supplied timezone definitions are likely to have DST behavior
394
 
         * that is right for the recent past and not so accurate further back.
395
 
         * Scoring in this way allows us to recognize zones that have some
396
 
         * commonality with the zic database, without insisting on exact match.
397
 
         * (Note: we probe Thursdays, not Sundays, to avoid triggering
398
 
         * DST-transition bugs in localtime itself.)
 
390
         * have sane TZ behavior further back anyway.  The further back the zone
 
391
         * matches, the better we score it.  This may seem like a rather random
 
392
         * way of doing things, but experience has shown that system-supplied
 
393
         * timezone definitions are likely to have DST behavior that is right for
 
394
         * the recent past and not so accurate further back. Scoring in this way
 
395
         * allows us to recognize zones that have some commonality with the zic
 
396
         * database, without insisting on exact match. (Note: we probe Thursdays,
 
397
         * not Sundays, to avoid triggering DST-transition bugs in localtime
 
398
         * itself.)
399
399
         */
400
400
        tnow = time(NULL);
401
401
        tm = localtime(&tnow);
404
404
        thisyear = tm->tm_year + 1900;
405
405
 
406
406
        t = build_time_t(thisyear, 1, 15);
 
407
 
407
408
        /*
408
409
         * Round back to GMT midnight Thursday.  This depends on the knowledge
409
410
         * that the time_t origin is Thu Jan 01 1970.  (With a different origin
731
732
                "Central Standard Time (Mexico)", "Central Daylight Time (Mexico)",
732
733
                "America/Mexico_City"
733
734
        },                                                      /* (GMT-06:00) Guadalajara, Mexico City,
734
 
                                                                   Monterrey - New */
 
735
                                                                 * Monterrey - New */
735
736
        {
736
737
                "China Standard Time", "China Daylight Time",
737
738
                "Asia/Hong_Kong"
852
853
        {
853
854
                "Mountain Standard Time (Mexico)", "Mountain Daylight Time (Mexico)",
854
855
                "America/Chihuahua"
855
 
        },                                                      /* (GMT-07:00) Chihuahua, La Paz, 
856
 
                                                                   Mazatlan - New */
 
856
        },                                                      /* (GMT-07:00) Chihuahua, La Paz, Mazatlan -
 
857
                                                                 * New */
857
858
        {
858
859
                "Myanmar Standard Time", "Myanmar Daylight Time",
859
860
                "Asia/Rangoon"
974
975
                "Australia/Perth"
975
976
        },                                                      /* (GMT+08:00) Perth */
976
977
/*      {"W. Central Africa Standard Time", "W. Central Africa Daylight Time",
977
 
         *       *       *       *       *       *       *      ""}, Could not find a match for this one. Excluded for now. *//* (
 
978
         *       *       *       *       *       *       *       *      ""}, Could not find a match for this one. Excluded for now. *//* (
978
979
         * G MT+01:00) West Central Africa */
979
980
        {
980
981
                "W. Europe Standard Time", "W. Europe Daylight Time",
1492
1493
                 * Load this timezone using tzload() not pg_tzset(), so we don't fill
1493
1494
                 * the cache
1494
1495
                 */
1495
 
                if (tzload(fullname + dir->baselen, dir->tz.TZname, &dir->tz.state, 
 
1496
                if (tzload(fullname + dir->baselen, dir->tz.TZname, &dir->tz.state,
1496
1497
                                   TRUE) != 0)
1497
1498
                {
1498
1499
                        /* Zone could not be loaded, ignore it */