mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
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.)
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user