mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
I don't care whether it's informix-compatible or not: #defining a word
like 'date' in a public header file is a damn fool idea.
This commit is contained in:
parent
b8f8896888
commit
fc73264005
@ -68,12 +68,12 @@ tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, timestamp *result)
|
|||||||
dDate = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1);
|
dDate = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1);
|
||||||
time = time2t(tm->tm_hour, tm->tm_min, tm->tm_sec, fsec);
|
time = time2t(tm->tm_hour, tm->tm_min, tm->tm_sec, fsec);
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
*result = (date * INT64CONST(86400000000)) + time;
|
*result = (dDate * INT64CONST(86400000000)) + time;
|
||||||
/* check for major overflow */
|
/* check for major overflow */
|
||||||
if ((*result - time) / INT64CONST(86400000000) != date)
|
if ((*result - time) / INT64CONST(86400000000) != dDate)
|
||||||
return -1;
|
return -1;
|
||||||
/* check for just-barely overflow (okay except time-of-day wraps) */
|
/* check for just-barely overflow (okay except time-of-day wraps) */
|
||||||
if ((*result < 0) ? (date >= 0) : (date < 0))
|
if ((*result < 0) ? (dDate >= 0) : (dDate < 0))
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
*result = ((dDate * 86400) + time);
|
*result = ((dDate * 86400) + time);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user