Hi hackers, While working on [1], I came across what seems to be incorrect comments in instr_time.h and an unneeded cast to int64.
Indeed, 03023a2664 represented time as an int64 on all platforms but forgot to update the comment related to INSTR_TIME_GET_MICROSEC() and provided an incorrect comment for INSTR_TIME_GET_NANOSEC(). Please find attached a tiny patch to correct those and, in passing, remove what I think is an unneeded cast to int64. [1]: https://www.postgresql.org/message-id/19E276C9-2C2B-435A-B275-8FA22222AEB8%40gmail.com Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
>From 1d1f8089a9eba4e87af66d7c0f23f30d52dc042c Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot <bertranddrouvot...@gmail.com> Date: Tue, 6 Aug 2024 08:04:43 +0000 Subject: [PATCH v1] Fix comments in instr_time.h and remove an unneeded cast to int64 03023a2664 represented time as an int64 on all platforms but forgot to update the comment related to INSTR_TIME_GET_MICROSEC() and provided an incorrect comment for INSTR_TIME_GET_NANOSEC(). In passing removing an unneeded cast to int64. --- src/include/portability/instr_time.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 100.0% src/include/portability/ diff --git a/src/include/portability/instr_time.h b/src/include/portability/instr_time.h index a6fc1922f2..8f9ba2f151 100644 --- a/src/include/portability/instr_time.h +++ b/src/include/portability/instr_time.h @@ -32,9 +32,9 @@ * * INSTR_TIME_GET_MILLISEC(t) convert t to double (in milliseconds) * - * INSTR_TIME_GET_MICROSEC(t) convert t to uint64 (in microseconds) + * INSTR_TIME_GET_MICROSEC(t) get t in microseconds * - * INSTR_TIME_GET_NANOSEC(t) convert t to uint64 (in nanoseconds) + * INSTR_TIME_GET_NANOSEC(t) get t in nanoseconds * * Note that INSTR_TIME_SUBTRACT and INSTR_TIME_ACCUM_DIFF convert * absolute times to intervals. The INSTR_TIME_GET_xxx operations are @@ -123,7 +123,7 @@ pg_clock_gettime_ns(void) ((t) = pg_clock_gettime_ns()) #define INSTR_TIME_GET_NANOSEC(t) \ - ((int64) (t).ticks) + ((t).ticks) #else /* WIN32 */ -- 2.34.1