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

Commit5d2adf0

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 parent806091c commit5d2adf0

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
@@ -773,12 +773,8 @@ float8_timestamptz(PG_FUNCTION_ARGS)
773773
{
774774
/* Out of range? */
775775
if (seconds<
776-
(float8)SECS_PER_DAY* (DATETIME_MIN_JULIAN-UNIX_EPOCH_JDATE))
777-
ereport(ERROR,
778-
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
779-
errmsg("timestamp out of range: \"%g\"",seconds)));
780-
781-
if (seconds >=
776+
(float8)SECS_PER_DAY* (DATETIME_MIN_JULIAN-UNIX_EPOCH_JDATE)
777+
||seconds >=
782778
(float8)SECS_PER_DAY* (TIMESTAMP_END_JULIAN-UNIX_EPOCH_JDATE))
783779
ereport(ERROR,
784780
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
@@ -788,7 +784,8 @@ float8_timestamptz(PG_FUNCTION_ARGS)
788784
seconds-= ((POSTGRES_EPOCH_JDATE-UNIX_EPOCH_JDATE)*SECS_PER_DAY);
789785

790786
#ifdefHAVE_INT64_TIMESTAMP
791-
result=rint(seconds*USECS_PER_SEC);
787+
seconds=rint(seconds*USECS_PER_SEC);
788+
result= (int64)seconds;
792789
#else
793790
result=seconds;
794791
#endif
@@ -1624,9 +1621,10 @@ make_interval(PG_FUNCTION_ARGS)
16241621
result->day=weeks*7+days;
16251622

16261623
#ifdefHAVE_INT64_TIMESTAMP
1624+
secs=rint(secs*USECS_PER_SEC);
16271625
result->time=hours* ((int64)SECS_PER_HOUR*USECS_PER_SEC)+
16281626
mins* ((int64)SECS_PER_MINUTE*USECS_PER_SEC)+
1629-
(int64)rint(secs*USECS_PER_SEC);
1627+
(int64)secs;
16301628
#else
16311629
result->time=hours* (double)SECS_PER_HOUR+
16321630
mins* (double)SECS_PER_MINUTE+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp