diff options
| author | Tom Lane | 2004-11-01 21:34:44 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-11-01 21:34:44 +0000 |
| commit | 5ba04cd9f17ac91cce7460310a2a6cbd714b7e8a (patch) | |
| tree | 0259ae8820694dd5b8cf1ef1bb9ce8e34761076b /src/include/pgtime.h | |
| parent | 7fad5fff0df0476ca80716153963d90c5776acf3 (diff) | |
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.)
Diffstat (limited to 'src/include/pgtime.h')
| -rw-r--r-- | src/include/pgtime.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/include/pgtime.h b/src/include/pgtime.h index 1c66a63d2f..8a1370cc8d 100644 --- a/src/include/pgtime.h +++ b/src/include/pgtime.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/include/pgtime.h,v 1.4 2004/08/29 05:06:55 momjian Exp $ + * $PostgreSQL: pgsql/src/include/pgtime.h,v 1.5 2004/11/01 21:34:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -37,12 +37,19 @@ struct pg_tm const char *tm_zone; }; -extern struct pg_tm *pg_localtime(const pg_time_t *); -extern struct pg_tm *pg_gmtime(const pg_time_t *); -extern bool pg_tzset(const char *tzname); +extern struct pg_tm *pg_localtime(const pg_time_t *timep); +extern struct pg_tm *pg_gmtime(const pg_time_t *timep); +extern int pg_next_dst_boundary(const pg_time_t *timep, + long int *before_gmtoff, + int *before_isdst, + pg_time_t *boundary, + long int *after_gmtoff, + int *after_isdst); extern size_t pg_strftime(char *s, size_t max, const char *format, const struct pg_tm * tm); + extern void pg_timezone_initialize(void); +extern bool pg_tzset(const char *tzname); extern bool tz_acceptable(void); extern const char *select_default_timezone(void); extern const char *pg_get_current_timezone(void); |
