mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
Make EXTRACT(TIMEZONE) and SET/SHOW TIMEZONE follow the SQL convention
for the sign of timezone offsets, ie, positive is east from UTC. These were previously out of step with other operations that accept or show timezones, such as I/O of timestamptz values.
This commit is contained in:
@ -183,12 +183,23 @@ typedef struct
|
||||
} datetkn;
|
||||
|
||||
|
||||
/* TMODULO()
|
||||
/* FMODULO()
|
||||
* Macro to replace modf(), which is broken on some platforms.
|
||||
* t = input and remainder
|
||||
* q = integer part
|
||||
* u = divisor
|
||||
*/
|
||||
#define FMODULO(t,q,u) \
|
||||
do { \
|
||||
q = ((t < 0) ? ceil(t / u): floor(t / u)); \
|
||||
if (q != 0) t -= rint(q * u); \
|
||||
} while(0)
|
||||
|
||||
/* TMODULO()
|
||||
* Like FMODULO(), but work on the timestamp datatype (either int64 or float8).
|
||||
* We assume that int64 follows the C99 semantics for division (negative
|
||||
* quotients truncate towards zero).
|
||||
*/
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
#define TMODULO(t,q,u) \
|
||||
do { \
|
||||
@ -198,7 +209,7 @@ do { \
|
||||
#else
|
||||
#define TMODULO(t,q,u) \
|
||||
do { \
|
||||
q = ((t < 0)? ceil(t / u): floor(t / u)); \
|
||||
q = ((t < 0) ? ceil(t / u): floor(t / u)); \
|
||||
if (q != 0) t -= rint(q * u); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user