Skip to content

Commit 79588d3

Browse files
committed
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
1 parent 9890a85 commit 79588d3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/backend/utils/misc/tzparser.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "utils/guc.h"
3030
#include "utils/memutils.h"
3131
#include "utils/tzparser.h"
32+
#include "utils/datetime.h"
3233

3334

3435
#define WHITESPACE " \t\n\r"
@@ -66,8 +67,8 @@ validateTzEntry(tzEntry *tzentry)
6667
/*
6768
* Sanity-check the offset: shouldn't exceed 14 hours
6869
*/
69-
if (tzentry->offset > 14 * 60 * 60 ||
70-
tzentry->offset < -14 * 60 * 60)
70+
if (tzentry->offset > 14 * SECS_PER_HOUR ||
71+
tzentry->offset < -14 * SECS_PER_HOUR)
7172
{
7273
GUC_check_errmsg("time zone offset %d is out of range in time zone file \"%s\", line %d",
7374
tzentry->offset,
@@ -155,7 +156,7 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
155156
* zones that probably will never be used in the current session.
156157
*/
157158
tzentry->zone = pstrdup(offset);
158-
tzentry->offset = 0;
159+
tzentry->offset = 0 * SECS_PER_HOUR;
159160
tzentry->is_dst = false;
160161
remain = strtok(NULL, WHITESPACE);
161162
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy