Commit Graph

335 Commits

Author SHA1 Message Date
Heikki Linnakangas 5d6f43bbeb Add MUST (Mauritius Island Summer Time) to the list of known abbreviations.
Mauritius began using DST in the summer 2008-2009; the Olson library has been
updated already.

Xavier Bugaud
2009-03-05 14:27:50 +00:00
Tom Lane 204db566b4 Update time zone data files to tzdata release 2009a: introduces Asia/Kathmandu
as the preferred spelling of that zone name, corrects historical DST
information for Switzerland and Cuba.
2009-01-29 19:59:59 +00:00
Bruce Momjian eaa088e8ee Fix new timezone cross-compile rule to avoid a bug in gmake 3.78.1;
document change.
2009-01-06 02:25:29 +00:00
Peter Eisentraut c63b9b1ddc When cross-compiling, allow and require an external zic program to be used
when --with-system-tzdata is not used.

initial patch by Richard Evans
2009-01-05 10:25:59 +00:00
Bruce Momjian 511db38ace Update copyright for 2009. 2009-01-01 17:24:05 +00:00
Tom Lane 312d51798f Suppress leap-second-aware timezones in the output of pg_tzenumerate_next,
and thereby in the pg_timezone_names view.  Although we allow such zones
to be used in certain limited contexts like AT TIME ZONE, we don't allow
them in SET TIME ZONE, and bug #4528 shows that they're more likely to
confuse users than do anything useful.  So hide 'em.  (Note that we don't
even generate these zones when installing our own timezone database.
But they are likely to be present when using a system-provided database.)
2008-11-13 20:49:38 +00:00
Tom Lane c8a18a282b Update time zone data files to tzdata release 2008i (DST law changes in
Argentina, Brazil, Mauritius, Syria).
2008-10-30 13:16:52 +00:00
Tom Lane fd84eb5e64 Update time zone data files to tzdata release 2008f (DST law changes in
Argentina, Bahamas, Brazil, Mauritius, Morocco, Pakistan, Palestine, Paraguay).
2008-09-17 14:18:39 +00:00
Tom Lane 8c3340fe16 Fix identify_system_timezone() so that it tests the behavior of the system
timezone setting in the current year and for 100 years back, rather than
always examining years 1904-2004.  The original coding would have problems
distinguishing zones whose behavior diverged only after 2004; which is a
situation we will surely face sometime, if it's not out there already.

In passing, also prevent selection of the dummy "Factory" timezone, even
if that's exactly what the system is using.  Reporting time as GMT seems
better than that.
2008-07-01 03:40:55 +00:00
Tom Lane c4fdebd926 Update time zone data files to tzdata release 2008c (DST law changes in
Morocco, Iraq, Choibalsan, Pakistan, Syria, Cuba, Argentina/San_Luis).
2008-06-01 18:23:00 +00:00
Tom Lane 94b0b545f8 Add SGT (Singapore time) to the default list of known timezone
abbreviations.  It doesn't conflict with any other abbreviation
so there seems no reason not to include it.  Per a recent gripe.
2008-05-01 20:05:08 +00:00
Bruce Momjian fca9fff41b More README src cleanups. 2008-03-21 13:23:29 +00:00
Tom Lane d31fb0e6b5 Update to tzdata 2008a distribution (Chilean DST law change). 2008-03-13 19:21:43 +00:00
Tom Lane 0f855d621b Venezuela Time now means UTC-4:30, not UTC-4:00. Adjust our treatment
of "VET" accordingly.  Per bug #3997 from Aaron Mizrachi.
2008-03-02 00:10:22 +00:00
Peter Eisentraut c7054a6c14 More refactoring, so that the SUBSYS.o rules are now all in one place. 2008-02-19 15:29:58 +00:00
Magnus Hagander 592487823d Fix function prototype to silence compiler warnings. 2008-02-19 12:06:35 +00:00
Tom Lane 0171e72d4d Update timezone code to track the upstream changes since 2003. In particular
this adds support for 64-bit tzdata files, which is needed to support DST
calculations beyond 2038.  Add a regression test case to give some minimal
confidence that that really works.

Heikki Linnakangas
2008-02-16 21:16:04 +00:00
Magnus Hagander 953c2c9b71 Update timezone mapping for Windows with new timezones added
in windows servicepacks.
Fix timezone mapping for "Mexico 2"
2008-02-11 19:55:11 +00:00
Tom Lane 69528aefbb Insert ARST into the list of known timezone abbreviations. 2008-01-02 21:42:00 +00:00
Tom Lane 1af45f1d35 Update time zone data files to tzdata release 2007k. 2008-01-01 20:45:10 +00:00
Bruce Momjian 9098ab9e32 Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
Bruce Momjian f6e8730d11 Re-run pgindent with updated list of typedefs. (Updated README should
avoid this problem in the future.)
2007-11-15 22:25:18 +00:00
Tom Lane d788c922d7 Update timezone data files to release 2007i of the zic database. 2007-11-15 21:21:14 +00:00
Bruce Momjian fdf5a5efb7 pgindent run for 8.3. 2007-11-15 21:14:46 +00:00
Tom Lane 8164fb8887 Avoid including any backend-only stuff in the zic utility program.
Per gripe from Zdenek Kotala, though not exactly his patch.
2007-10-26 13:30:10 +00:00
Tom Lane 08e5749c6d Update timezone data files to release 2007h of the zic database.
Might as well have the latest when we wrap 8.3beta1.
2007-10-04 19:06:59 +00:00
Tom Lane 16f8a9e4e1 Sync timezone data with 2007g zic release. 2007-09-11 17:43:27 +00:00
Tom Lane 75d5f6fe79 Adjust with-system-tzdata patch to not attempt to install a symlink,
but just hardwire the specified timezone database path into the executable.
Per discussion, this avoids some packaging disadvantages of using a
symlink.
2007-08-25 20:29:25 +00:00
Peter Eisentraut 4e94d1f952 Add configure option --with-system-tzdata to use operating system time zone
database.
2007-08-20 08:53:12 +00:00
Tom Lane 4fd8d6b3e7 Fix crash caused by log_timezone patch if we attempt to emit any elog messages
between the setting of log_line_prefix and the setting of log_timezone.  We
can't realistically set log_timezone any earlier than we do now, so the best
behavior seems to be to use GMT zone if any timestamps are to be logged during
early startup.  Create a dummy zone variable with a minimal definition of GMT
(in particular it will never know about leap seconds), so that we can set it
up without reference to any external files.
2007-08-04 19:29:25 +00:00
Tom Lane bdd6b62245 Switch over to using the src/timezone functions for formatting timestamps
displayed in the postmaster log.  This avoids Windows-specific problems with
localized time zone names that are in the wrong encoding, and generally seems
like a good idea to forestall other potential platform-dependent issues.
To preserve the existing behavior that all backends will log in the same time
zone, create a new GUC variable log_timezone that can only be changed on a
system-wide basis, and reference log-related calculations to that zone instead
of the TimeZone variable.

This fixes the issue reported by Hiroshi Saito that timestamps printed by
xlog.c startup could be improperly localized on Windows.  We still need a
simpler patch for that problem in the back branches, however.
2007-08-04 01:26:54 +00:00
Peter Eisentraut 7ce9b3683e Make some messages more consistent 2007-05-31 15:13:06 +00:00
Tom Lane 9350056eaa Sync timezone data with 2007e zic release. 2007-04-19 22:44:32 +00:00
Tom Lane 0169c354bf Arrange to install a "posixrules" entry in our timezone database, so that
POSIX-style timezone specs that don't exactly match any database entry will
be treated as having correct USA DST rules.  Also, document that this can
be changed if you want to use some other DST rules with a POSIX zone spec.

We could consider changing localtime.c's TZDEFRULESTRING, but since that
facility can only deal with one DST transition rule, it seems fairly useless
now; might as well just plan to override it using a "posixrules" entry.

Backpatch as far as 8.0.  There isn't much we can do in 7.x ... either your
libc gets it right, or it doesn't.
2007-03-14 17:38:06 +00:00
Peter Eisentraut 4ab8fcba8a StrNCpy -> strlcpy (not complete) 2007-02-10 14:58:55 +00:00
Peter Eisentraut c138b966d4 Replace useless uses of := by = in makefiles. 2007-02-09 15:56:00 +00:00
Bruce Momjian 8b4ff8b6a1 Wording cleanup for error messages. Also change can't -> cannot.
Standard English uses "may", "can", and "might" in different ways:

        may - permission, "You may borrow my rake."

        can - ability, "I can lift that log."

        might - possibility, "It might rain today."

Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice.  Similarly, "It may crash" is better stated, "It might crash".
2007-02-01 19:10:30 +00:00
Neil Conway 8ff2bccee3 Squelch some VC++ compiler warnings. Mark float literals with the "f"
suffix, to distinguish them from doubles. Make some function declarations
and definitions use the "const" qualifier for arguments consistently.
Ignore warning 4102 ("unreferenced label"), because such warnings
are always emitted by bison-generated code. Patch from Magnus Hagander.
2007-01-26 17:45:42 +00:00
Bruce Momjian 29dccf5fe0 Update CVS HEAD for 2007 copyright. Back branches are typically not
back-stamped for this.
2007-01-05 22:20:05 +00:00
Tom Lane 782d68e38d Put JST back into the default set of timezone abbreviations;
was removed in an unexplainable moment of brain fade.
2006-12-15 16:54:43 +00:00
Tom Lane 765cc1588f Update timezone data to tzdata2006p zic distribution. It seems Western
Australia decided to institute DST with one month's notice ... way to go,
politicians.
2006-11-28 19:37:03 +00:00
Tom Lane d735804f88 Translate Windows' GMT Standard Time/GMT Daylight Time zones to
zic's Europe/London, rather than Europe/Dublin as before.  This seems
a less surprising choice, particularly with respect to dates before
1948.  Original suggestion was to translate to straight GMT, but this
seems wrong given that these zones *are* DST-aware.  Per offlist
discussion with Magnus.
2006-11-21 23:11:55 +00:00
Tom Lane c1fdbba49f Update zic database to tzdata2006n. 2006-11-01 05:20:38 +00:00
Tom Lane d8221dfa6d Tweak zic.c to compile cleanly on MSVC: use CopyFile instead of
CopyFileEx.  This avoids a warning about the function not being
present on older Windows versions.  Magnus Hagander
2006-10-24 15:11:03 +00:00
Tom Lane 443abd83e5 Add externs for optarg/optind where apparently needed. Per Magnus. 2006-10-19 20:38:48 +00:00
Tom Lane 877f08da14 Fix up timetz input so that a date is required only when the specified
timezone actually has a daylight-savings rule.  This avoids breaking
cases that used to work because they went through the DecodePosixTimezone
code path.  Per contrib regression failures (mea culpa for not running
those yesterday...).  Also document the already-applied change to allow
GMT offsets up to 14 hours.
2006-10-18 16:43:14 +00:00
Tom Lane 0b35b01e7a Arrange for timezone names to be recognized case-insensitively; for
example SET TIME ZONE 'america/new_york' works now.  This seems a good
idea on general user-friendliness grounds, and is part of the solution
to the timestamp-input parsing problems I noted recently.
2006-10-16 19:58:27 +00:00
Bruce Momjian f99a569a2e pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
Tom Lane 5ff4f39c0e Rename the recently-added pg_timezonenames view to pg_timezone_abbrevs,
and create a new view pg_timezone_names that provides information about
the zones known in the 'zic' database.  Magnus Hagander, with some
additional work by Tom Lane.
2006-09-16 20:14:34 +00:00
Tom Lane 7ed5df437d Update timezone data files to release 2006k of the zic database. 2006-09-16 17:21:03 +00:00
Tom Lane bd112776cd Add missing @OVERRIDE to 'India' config file, per Michael Fuhr.
Add $PostgreSQL$ lines for CVS identity, too.
2006-07-25 13:49:21 +00:00
Tom Lane d8b5c95ca8 Remove hard-wired lists of timezone abbreviations in favor of providing
configuration files that can be altered by a DBA.  The australian_timezones
GUC setting disappears, replaced by a timezone_abbreviations setting (set this
to 'Australia' to get the effect of australian_timezones).  The list of zone
names defined by default has undergone a bit of cleanup, too.  Documentation
still needs some work --- in particular, should we fix Table B-4, or just get
rid of it?  Joachim Wieland, with some editorializing by moi.
2006-07-25 03:51:23 +00:00
Bruce Momjian e0522505bd Remove 576 references of include files that were not needed. 2006-07-14 14:52:27 +00:00
Tom Lane ae643747b1 Fix a passel of recently-committed violations of the rule 'thou shalt
have no other gods before c.h'.  Also remove some demonstrably redundant
#include lines, mostly of <errno.h> which was added to c.h years ago.
2006-07-14 05:28:29 +00:00
Bruce Momjian 51e8882197 Revert part of recent include patch not ready for application. 2006-07-14 04:59:30 +00:00
Bruce Momjian 03c2e5924e Add additional includes needed on some platforms. 2006-07-14 04:44:46 +00:00
Bruce Momjian b85a965f5f Allow each C include file to compile on its own by including any needed
header files.
2006-07-11 13:54:25 +00:00
Bruce Momjian 399a36a75d Prepare code to be built by MSVC:
o  remove many WIN32_CLIENT_ONLY defines
	o  add WIN32_ONLY_COMPILER define
	o  add 3rd argument to open() for portability
	o  add include/port/win32_msvc directory for
	   system includes

Magnus Hagander
2006-06-07 22:24:46 +00:00
Tom Lane 513ec43ebd Suppress a couple of minor compiler warnings, per Magnus. 2006-04-09 19:21:34 +00:00
Bruce Momjian f3d99d160d Add CVS tag lines to files that were lacking them. 2006-03-11 04:38:42 +00:00
Bruce Momjian f2f5b05655 Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
Peter Eisentraut a29c04a541 Allow installation into directories containing spaces in the name. 2005-12-09 21:19:36 +00:00
Bruce Momjian 436a2956d8 Re-run pgindent, fixing a problem where comment lines after a blank
comment line where output as too long, and update typedefs for /lib
directory.  Also fix case where identifiers were used as variable names
in the backend, but as typedefs in ecpg (favor the backend for
indenting).

Backpatch to 8.1.X.
2005-11-22 18:17:34 +00:00
Bruce Momjian 1dc3498251 Standard pgindent run for 8.1. 2005-10-15 02:49:52 +00:00
Tom Lane a239af02c3 Fix the various forms of AT TIME ZONE to accept either timezones found
in the zic database or zone names found in the date token table.  This
preserves the old ability to do AT TIME ZONE 'PST' along with the new
ability to do AT TIME ZONE 'PST8PDT'.  Per gripe from Bricklen Anderson.
Also, fix some inconsistencies in usage of TZ_STRLEN_MAX --- the old
code had the potential for one-byte buffer overruns, though given
alignment considerations it's unlikely there was any real risk.
2005-09-09 02:31:50 +00:00
Tom Lane 69d48cefd1 Update timezone data files to release 2005m of the zic database.
Among other changes, this reflects the recently passed change in USA
daylight savings rules.
2005-09-07 21:39:25 +00:00
Bruce Momjian 970bb03c3c Complete zic patch backout by removing NO_PGPORT workaround. 2005-07-06 21:40:09 +00:00
Bruce Momjian 261ffd03f7 Reverse out because the lack of using pgport in timezone/ is causing
problems:

---------------------------------------------------------------------------

Support cross compilation by compiling "zic" with a native compiler.
This relies on the output of zic being platform independent, but that is
currently the case.
2005-07-06 21:04:14 +00:00
Bruce Momjian 4f979e8bac Restructure zic #define fprintf checks to use a NO_PGPORT macro instead. 2005-07-04 19:54:51 +00:00
Bruce Momjian 4b97d51c0a Fix compile if zic because it now doesn't use libpgport. 2005-07-04 18:21:40 +00:00
Neil Conway 3f39cbdce1 Fix build break for out of tree (vpath) builds, induced by recent zic
changes.
2005-07-04 02:55:59 +00:00
Peter Eisentraut 85884cb1de Support cross compilation by compiling "zic" with a native compiler. This
relies on the output of zic being platform independent, but that is
currently the case.
2005-07-03 18:54:28 +00:00
Tom Lane 06ae88a82e Tweak dynahash.c to not allocate so many entries at once when dealing
with a table that has a small predicted size.  Avoids wasting several
hundred K on the timezone hash table, which is likely to have only one
or a few entries, but the entries use up 10Kb apiece ...
2005-06-26 23:32:34 +00:00
Neil Conway 0b62bbe086 Cosmetic improvements to the timezone code: remove the use of the
'register' qualifier, make some function declarations more consistent,
and so on.
2005-06-20 08:00:51 +00:00
Tom Lane 3f749924f8 Simplify uses of readdir() by creating a function ReadDir() that
includes error checking and an appropriate ereport(ERROR) message.
This gets rid of rather tedious and error-prone manipulation of errno,
as well as a Windows-specific bug workaround, at more than a dozen
call sites.  After an idea in a recent patch by Heikki Linnakangas.
2005-06-19 21:34:03 +00:00
Bruce Momjian 0851a6fbc7 This patch makes it possible to use the full set of timezones when doing
"AT TIME ZONE", and not just the shorlist previously available. For
example:

SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';

works fine now. It will also obey whatever DST rules were in effect at
just that date, which the previous implementation did not.

It also supports the AT TIME ZONE on the timetz datatype. The whole
handling of DST is a bit bogus there, so I chose to make it use whatever
DST rules are in effect at the time of executig the query. not sure if
anybody is actuallyi *using* timetz though, it seems pretty
unpredictable just because of this...

Magnus Hagander
2005-06-15 00:34:11 +00:00
Bruce Momjian f4c4f1ce52 >> Do you agree that using a hashtable for it in general is a good idea
>> assuming this sideeffect is removed, though?
>
>I have no problem with the hashtable, only with preloading it with
>everything.  What I'd like to see is that the table inherited at fork()
>contains just the data for the default timezone.  (At least in the
>normal case where that setting hasn't been changed since postmaster
>start.)

Here's a patch doing this. Changes score_timezone not to use pg_tzset(),
and thus not loading all the zones in the cache. The actual timezone
being picked will be set using set_global_timezone() which in turn calls
pg_tzset() and loads it in the cache.

Magnus Hagander
2005-06-15 00:09:26 +00:00
Tom Lane e92a88272e Modify hash_search() API to prevent future occurrences of the error
spotted by Qingqing Zhou.  The HASH_ENTER action now automatically
fails with elog(ERROR) on out-of-memory --- which incidentally lets
us eliminate duplicate error checks in quite a bunch of places.  If
you really need the old return-NULL-on-out-of-memory behavior, you
can ask for HASH_ENTER_NULL.  But there is now an Assert in that path
checking that you aren't hoping to get that behavior in a palloc-based
hash table.
Along the way, remove the old HASH_FIND_SAVE/HASH_REMOVE_SAVED actions,
which were not being used anywhere anymore, and were surely too ugly
and unsafe to want to see revived again.
2005-05-29 04:23:07 +00:00
Bruce Momjian 4550c1e519 More macro cleanups for date/time. 2005-05-23 21:54:02 +00:00
Bruce Momjian aa8bdab272 Attached patch gets rid of the global timezone in the following steps:
* Changes the APIs to the timezone functions to take a pg_tz pointer as
an argument, representing the timezone to use for the selected
operation.

* Adds a global_timezone variable that represents the current timezone
in the backend as set by SET TIMEZONE (or guc, or env, etc).

* Implements a hash-table cache of loaded tables, so we don't have to
read and parse the TZ file everytime we change a timezone. While not
necesasry now (we don't change timezones very often), I beleive this
will be necessary (or at least good) when "multiple timezones in the
same query" is eventually implemented. And code-wise, this was the time
to do it.


There are no user-visible changes at this time. Implementing the
"multiple zones in one query" is a later step...

This also gets rid of some of the cruft needed to "back out a timezone
change", since we previously couldn't check a timezone unless it was
activated first.

Passes regression tests on win32, linux (slackware 10) and solaris x86.

Magnus Hagander
2005-04-19 03:13:59 +00:00
Bruce Momjian e3267b6517 Properly undef _(x) gettext macro. 2005-02-23 04:34:21 +00:00
Bruce Momjian 0542b1e2fe Use _() macro consistently rather than gettext(). Add translation
macros around strings that were missing them.
2005-02-22 04:43:23 +00:00
PostgreSQL Daemon 2ff501590b Tag appropriate files for rc3
Also performed an initial run through of upgrading our Copyright date to
extend to 2005 ... first run here was very simple ... change everything
where: grep 1996-2004 && the word 'Copyright' ... scanned through the
generated list with 'less' first, and after, to make sure that I only
picked up the right entries ...
2004-12-31 22:04:05 +00:00
Tom Lane 0686fe331f make clean must remove zic$(X) for Windows, per Magnus. 2004-12-31 19:01:54 +00:00
Tom Lane 5ba04cd9f1 Invent pg_next_dst_boundary() and rewrite DetermineLocalTimeZone() to
use it, as per my proposal of yesterday.  This gives us a means of
determining the zone offset to impute to an unlabeled timestamp that
is both efficient and reliable, unlike all our previous tries involving
mktime() and localtime().  The behavior for invalid or ambiguous times
at a DST transition is fixed to be really and truly "assume standard
time", fixing a bug that has come and gone repeatedly but was back
again in 7.4.  (There is some ongoing discussion about whether we should
raise an error instead, but for the moment I'll make it do what it was
previously intended to do.)
2004-11-01 21:34:44 +00:00
Tom Lane 15db03181a Sync timezone data with latest zic database (dated Oct 11 2004). 2004-10-24 15:09:57 +00:00
Tom Lane 261f184f0c Update RELEASE_CHANGES to mention updating the timezone database as
a routine part of release prep.
2004-10-24 15:01:54 +00:00
Bruce Momjian 24201b4bc6 Make libpgport be front-end only and make libpgport_srv be a backend
library that uses palloc, ereport, etc.  This simplifies the makefiles
for client applications.
2004-10-04 13:43:59 +00:00
Bruce Momjian 32b24bfa97 Remove inclusion of windows.h now that it is included in c.h, per idea
from Peter.
2004-09-27 19:16:03 +00:00
Bruce Momjian e97c817092 Use _timezone global on Cygwin instead of timezone. 2004-09-08 19:43:12 +00:00
Bruce Momjian bf831f6e9f Back out timezone detection patch. Tom already applied it. 2004-09-02 01:15:06 +00:00
Bruce Momjian 525449be27 This patch attempts to fix the issue with localized timezones on
Windows.

Recap: When running on a localized windows version, the timezone name
returned is also localized, and therefor does not match our lookup
table.

Solution: The registry contains both the name of the timezone in english
and the localized name. The patch adds code to scan the registry for the
localized name and gets the english name from that, and then rescans the
table.

I have tested this on a Swedish WinXP, and it works without problems.
The registry layout is the same in Win2k, but I haven't specifically
tested it. It's also the same on different languages but again only
Swedish is tested.

Magnus Hagander
2004-09-02 01:03:59 +00:00
Tom Lane d1b2260cdc Add code to be able to match the timezone name on localized Windows
systems.  Magnus Hagander.
2004-09-01 16:21:50 +00:00
Bruce Momjian 15d3f9f6b7 Another pgindent run with lib typedefs added. 2004-08-30 02:54:42 +00:00
Bruce Momjian b6b71b85bc Pgindent run for 8.0. 2004-08-29 05:07:03 +00:00
Bruce Momjian da9a8649d8 Update copyright to 2004. 2004-08-29 04:13:13 +00:00
Tom Lane 178ec6f40e Fix function definition that somehow missed being ANSI-fied, and align
it with previous prototype to suppress complaints from picky compilers,
per report from Scott Bailey.  Also, remove substitute strerror
definition --- not needed, since we link this with libpgport.
2004-08-11 16:53:28 +00:00
Bruce Momjian 8120ff636b More Win32 zic build cleanups now that we have symlinks, it needs help. 2004-08-08 05:19:44 +00:00
Bruce Momjian 988d84f4a7 Another zic cleanup . 2004-08-08 04:53:41 +00:00
Bruce Momjian 68993b650f Link in dirmod specially for zic so it works on Win32. 2004-08-08 03:57:35 +00:00
Tom Lane 2def4552ed Still another try at matching system timezone nicely. On non-Windows
machines, break tie scores by preferring shorter zone names over longer;
for names of equal length, prefer the alphabetically first name.  This
yields for example 'EST5EDT' not 'America/New_York' for US eastern time.
On Windows, abandon the whole concept of inspecting the detailed behavior
of the system TZ library, because it doesn't bear inspection :-(.  Instead
use a hardwired mapping table to select our zone name based on the
result of strftime %Z output.  Windows code from Magnus Hagander.
2004-07-31 19:12:15 +00:00
Tom Lane 94f8f63fdb Must guard against NULL return from localtime() when probing pre-1970
dates.  Per Magnus Hagander.
2004-07-30 17:31:24 +00:00
Tom Lane e31c8cf20b Still another try at automatically detecting the best match in the zic
timezone database for the system behavior we find ourselves in.  Scan
backwards from current time and choose the zone that matches furthest
back.  As per discussion a week or so back.
2004-07-22 05:28:30 +00:00
Tom Lane 68938c4770 Add missing <getopt.h>, per Dann Corbit. 2004-07-22 01:41:24 +00:00
Tom Lane 99b225c528 Check more test points (in fact, every week in 1970..2004) to get a more
accurate matching of our time zone to the system's zone.  This method is
able to distinguish Antarctica/Casey from Australia/Perth, as in Chris
K-L's recent example; and it is not materially slower than before, because
the extra checks generally don't get done against very many time zones.

It seems possible that with this test we'd be able to correctly identify
Windows timezones without looking at the timezone name, but I do not
have the ability to try it.
2004-07-10 23:06:50 +00:00
Tom Lane 921d749bd4 Adjust our timezone library to use pg_time_t (typedef'd as int64) in
place of time_t, as per prior discussion.  The behavior does not change
on machines without a 64-bit-int type, but on machines with one, which
is most, we are rid of the bizarre boundary behavior at the edges of
the 32-bit-time_t range (1901 and 2038).  The system will now treat
times over the full supported timestamp range as being in your local
time zone.  It may seem a little bizarre to consider that times in
4000 BC are PST or EST, but this is surely at least as reasonable as
propagating Gregorian calendar rules back that far.

I did not modify the format of the zic timezone database files, which
means that for the moment the system will not know about daylight-savings
periods outside the range 1901-2038.  Given the way the files are set up,
it's not a simple decision like 'widen to 64 bits'; we have to actually
think about the range of years that need to be supported.  We should
probably inquire what the plans of the upstream zic people are before
making any decisions of our own.
2004-06-03 02:08:07 +00:00
Tom Lane 37da0ba0e0 Seems we forgot the installdirs target in this makefile. 2004-05-28 03:53:33 +00:00
Tom Lane bfb77c15ca Tweaks per discussion with Magnus: suppress chatter on unpatched MinGW
systems, add verbose logging (at DEBUG4) to help identify why a given
time zone is not matched.
2004-05-25 19:46:21 +00:00
Tom Lane 76c50c080b Add code to identify_system_timezone() to try all zones in the zic
database, not just ones that we cons up POSIX names for.  This looks
grim but it seems to take less than a second even on a relatively slow
machine, and since it only happens once during postmaster startup, that
seems acceptable.
2004-05-25 18:08:59 +00:00
Tom Lane dc39937762 Rewrite identify_system_timezone() to give it better-than-chance odds
of correctly identifying the system's daylight-savings transition rules.
This still begs the question of how to look through the zic database to
find a matching zone definition, but at least now we'll have some chance
of recognizing the match when we find it.
2004-05-24 02:30:29 +00:00
Tom Lane 17edb84056 Seems we had the wrong sign convention for the default Etc/GMTx zone
names.  Per report from Alvaro.
2004-05-23 23:26:53 +00:00
Tom Lane f9df1b28e8 Use case-insensitive comparison so that explicitly setting timezone=unknown
in postgresql.conf does the right thing.  variable.c got this right, but
not pgtz.c ...
2004-05-23 22:24:08 +00:00
Tom Lane 323a45099a Fix to install correctly in vpath build case. 2004-05-22 21:02:32 +00:00
Tom Lane d584db6086 pgindent did a pretty awful job on the timezone code, particularly with
respect to doubly-starred comment blocks.  Do some manual cleanup.
2004-05-21 20:59:10 +00:00
Bruce Momjian 0a19fb42c2 Pgindent timezone file, per request from Tom. 2004-05-21 12:30:25 +00:00
Tom Lane 63bd0db121 Integrate src/timezone library for all platforms. There is more we can
and should do now that we control our own destiny for timezone handling,
but this commit gets the bulk of the picayune diffs in place.
Magnus Hagander and Tom Lane.
2004-05-21 05:08:06 +00:00
Bruce Momjian 48eb73b556 Allow zic to compile by defining a "" value for my_exec_path. It isn't
used by zic anyway.
2004-05-19 01:17:42 +00:00
Bruce Momjian f3f8d36a57 Update Makefile dependencies for Win32 timezones, per Claudio. 2004-05-18 04:10:33 +00:00
Bruce Momjian 3b382d1ae3 Clean up some relative path install issues with Claudio's help. 2004-05-18 03:36:45 +00:00
Bruce Momjian 3febb477e6 Reorganize code to allow path-relative installs.
Create new get_* functions to access compiled-in paths and adjust if
relative installs are to be used.

Clean up substitute_libpath_macro() code.
2004-05-17 14:35:34 +00:00
Bruce Momjian deb78dd833 More win32 adjustment for timezone directory. 2004-05-02 03:12:12 +00:00
Bruce Momjian f4c69c8205 Fix timezone data path for Unix and win32. 2004-05-01 22:07:03 +00:00
Bruce Momjian ddfc4d1681 Remove debug output line. 2004-05-01 01:38:53 +00:00
Bruce Momjian 0a2b9f9cde Rename function to be less win32 specific. 2004-05-01 01:34:47 +00:00
Bruce Momjian 85b7e8351f Fix zic compiler to use pg version.
Move timezone database to share/timezone.
2004-04-30 20:23:28 +00:00
Bruce Momjian 04d426ba70 Allow build of timezone database on unix. 2004-04-30 20:01:39 +00:00
Bruce Momjian 1360fe4096 More timezone build adjustments. 2004-04-30 17:52:07 +00:00
Bruce Momjian 46050a3b75 Timezone code checks for HAVE_SYMLINK of zero, so use in pgtz.h:
#ifndef HAVE_SYMLINK
#define HAVE_SYMLINK 0
#endif
2004-04-30 16:58:48 +00:00
Bruce Momjian 82700281d0 More cleanups for USE_PGTZ. 2004-04-30 16:08:01 +00:00
Bruce Momjian a640845c88 Allow timezone to compile under Unix by blocking 'timezone' conflict with
system headers.

Allow system to find timezone database by pasing pkglibdir into the
binary via a define.
2004-04-30 14:24:14 +00:00
Bruce Momjian e9a028f81f Convert DOS newlines to Unix newlines. 2004-04-30 04:44:06 +00:00
Bruce Momjian 7146eb0bc3 Integrate timezone library to be called only from Win32.
Timezone code backend integration done by Magnus Hagander.
2004-04-30 04:31:52 +00:00
Bruce Momjian 4a73eb5ab1 Minor adjustments to enable public-domain timezone library to be called
from our code.
2004-04-30 04:14:06 +00:00
Bruce Momjian d248a67af1 Timezone library changes to map into our backend code. 2004-04-30 04:11:58 +00:00
Bruce Momjian 6a2b75c2c8 Add Olson's public domain timezone library to src/timezone. 2004-04-30 04:09:23 +00:00