]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Replace float8 with int in date2isoweek() and date2isoyear().
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 12 Jul 2025 15:50:35 +0000 (11:50 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 12 Jul 2025 15:50:37 +0000 (11:50 -0400)
commit84ce2587075c9418deda6a2f04b9768e375ebe43
tree63ba4f32d04b2f535f435e60492a5414dae0bd30
parentf2c87ac04e73511a19dc36343f102eed3332573c
Replace float8 with int in date2isoweek() and date2isoyear().

The values of the "result" variables in these functions are
always integers; using a float8 variable accomplishes nothing
except to incur useless conversions to and from float.  While
that wastes a few nanoseconds, these functions aren't all that
time-critical.  But it seems worth fixing to remove possible
reader confusion.

Also, in the case of date2isoyear(), "result" is a very poorly
chosen variable name because it is *not* the function's result.
Rename it to "week", and do the same in date2isoweek() for
consistency.

Since this is mostly cosmetic, there seems little need
for back-patch.

Author: Sergey Fukanchik <s.fukanchik@postgrespro.ru>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/6323a-68726500-1-7def9d00@137821581
src/backend/utils/adt/timestamp.c