mirror of
https://github.com/postgres/postgres.git
synced 2025-05-28 05:21:27 +03:00
Use SECS_PER_HOUR macro in tzparser.c, instead of constants
Reported-by: CharSyam Discussion: https://postgr.es/m/CAMrLSE5j_aWfoBDMrSvk14oBKSy+-2cjzNNH_FciirA7Kwo9TA@mail.gmail.com Author: CharSyam Backpatch-through: master
This commit is contained in:
parent
9890a855ae
commit
79588d3c8d
@ -29,6 +29,7 @@
|
|||||||
#include "utils/guc.h"
|
#include "utils/guc.h"
|
||||||
#include "utils/memutils.h"
|
#include "utils/memutils.h"
|
||||||
#include "utils/tzparser.h"
|
#include "utils/tzparser.h"
|
||||||
|
#include "utils/datetime.h"
|
||||||
|
|
||||||
|
|
||||||
#define WHITESPACE " \t\n\r"
|
#define WHITESPACE " \t\n\r"
|
||||||
@ -66,8 +67,8 @@ validateTzEntry(tzEntry *tzentry)
|
|||||||
/*
|
/*
|
||||||
* Sanity-check the offset: shouldn't exceed 14 hours
|
* Sanity-check the offset: shouldn't exceed 14 hours
|
||||||
*/
|
*/
|
||||||
if (tzentry->offset > 14 * 60 * 60 ||
|
if (tzentry->offset > 14 * SECS_PER_HOUR ||
|
||||||
tzentry->offset < -14 * 60 * 60)
|
tzentry->offset < -14 * SECS_PER_HOUR)
|
||||||
{
|
{
|
||||||
GUC_check_errmsg("time zone offset %d is out of range in time zone file \"%s\", line %d",
|
GUC_check_errmsg("time zone offset %d is out of range in time zone file \"%s\", line %d",
|
||||||
tzentry->offset,
|
tzentry->offset,
|
||||||
@ -155,7 +156,7 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
|
|||||||
* zones that probably will never be used in the current session.
|
* zones that probably will never be used in the current session.
|
||||||
*/
|
*/
|
||||||
tzentry->zone = pstrdup(offset);
|
tzentry->zone = pstrdup(offset);
|
||||||
tzentry->offset = 0;
|
tzentry->offset = 0 * SECS_PER_HOUR;
|
||||||
tzentry->is_dst = false;
|
tzentry->is_dst = false;
|
||||||
remain = strtok(NULL, WHITESPACE);
|
remain = strtok(NULL, WHITESPACE);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user