1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Sync our copy of the timezone library with IANA release tzcode2017b.

zic no longer mishandles some transitions in January 2038 when it
attempts to work around Qt bug 53071.  This fixes a bug affecting
Pacific/Tongatapu that was introduced in zic 2016e.  localtime.c
now contains a workaround, useful when loading a file generated by
a buggy zic.

There are assorted cosmetic changes as well, notably relocation
of a bunch of #defines.
This commit is contained in:
Tom Lane
2017-04-30 15:13:51 -04:00
parent 12d11432b4
commit e18b2c480d
7 changed files with 139 additions and 99 deletions

View File

@ -17,6 +17,7 @@
#include <sys/stat.h>
#include <time.h>
#include "datatype/timestamp.h"
#include "miscadmin.h"
#include "pgtz.h"
#include "storage/fd.h"
@ -308,14 +309,14 @@ pg_tzset_offset(long gmtoffset)
char tzname[128];
snprintf(offsetstr, sizeof(offsetstr),
"%02ld", absoffset / SECSPERHOUR);
absoffset %= SECSPERHOUR;
"%02ld", absoffset / SECS_PER_HOUR);
absoffset %= SECS_PER_HOUR;
if (absoffset != 0)
{
snprintf(offsetstr + strlen(offsetstr),
sizeof(offsetstr) - strlen(offsetstr),
":%02ld", absoffset / SECSPERMIN);
absoffset %= SECSPERMIN;
":%02ld", absoffset / SECS_PER_MINUTE);
absoffset %= SECS_PER_MINUTE;
if (absoffset != 0)
snprintf(offsetstr + strlen(offsetstr),
sizeof(offsetstr) - strlen(offsetstr),