Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc96a5f

Browse files
committed
Blind try to fix portability issue in commit8f93bd8 et al.
The S/390 members of the buildfarm are showing failures indicatingthat they're having trouble with the rint() calls I added yesterday.There's no good reason for that, and I wonder if it is a compiler bugsimilar to the one we worked around ind9476b8. Try to fix it usingthe same method as before, namely to store the result of rint() backinto a "double" variable rather than immediately converting to int64.(This isn't entirely waving a dead chicken, since on machines withwider-than-double float registers, the extra store forces a widthconversion. I don't know if S/390 is like that, but it seems worthtrying.)In passing, merge duplicate ereport() calls in float8_timestamptz().Per buildfarm.
1 parent404756f commitfc96a5f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎src/backend/utils/adt/timestamp.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -764,12 +764,8 @@ float8_timestamptz(PG_FUNCTION_ARGS)
764764
{
765765
/* Out of range? */
766766
if (seconds<
767-
(float8)SECS_PER_DAY* (DATETIME_MIN_JULIAN-UNIX_EPOCH_JDATE))
768-
ereport(ERROR,
769-
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
770-
errmsg("timestamp out of range: \"%g\"",seconds)));
771-
772-
if (seconds >=
767+
(float8)SECS_PER_DAY* (DATETIME_MIN_JULIAN-UNIX_EPOCH_JDATE)
768+
||seconds >=
773769
(float8)SECS_PER_DAY* (TIMESTAMP_END_JULIAN-UNIX_EPOCH_JDATE))
774770
ereport(ERROR,
775771
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
@@ -779,7 +775,8 @@ float8_timestamptz(PG_FUNCTION_ARGS)
779775
seconds-= ((POSTGRES_EPOCH_JDATE-UNIX_EPOCH_JDATE)*SECS_PER_DAY);
780776

781777
#ifdefHAVE_INT64_TIMESTAMP
782-
result=rint(seconds*USECS_PER_SEC);
778+
seconds=rint(seconds*USECS_PER_SEC);
779+
result= (int64)seconds;
783780
#else
784781
result=seconds;
785782
#endif
@@ -1615,9 +1612,10 @@ make_interval(PG_FUNCTION_ARGS)
16151612
result->day=weeks*7+days;
16161613

16171614
#ifdefHAVE_INT64_TIMESTAMP
1615+
secs=rint(secs*USECS_PER_SEC);
16181616
result->time=hours* ((int64)SECS_PER_HOUR*USECS_PER_SEC)+
16191617
mins* ((int64)SECS_PER_MINUTE*USECS_PER_SEC)+
1620-
(int64)rint(secs*USECS_PER_SEC);
1618+
(int64)secs;
16211619
#else
16221620
result->time=hours* (double)SECS_PER_HOUR+
16231621
mins* (double)SECS_PER_MINUTE+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp