From b6aa2fc03be86142a18ab0792845db04b679dff3 Mon Sep 17 00:00:00 2001 From: hanf Date: Mon, 29 Jul 2024 21:00:33 +0800 Subject: [PATCH] Improve performance, use const instead of pow function. --- src/u-blox_GNSS.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/u-blox_GNSS.cpp b/src/u-blox_GNSS.cpp index a5a1059..ee1b30c 100644 --- a/src/u-blox_GNSS.cpp +++ b/src/u-blox_GNSS.cpp @@ -18477,9 +18477,9 @@ uint32_t DevUBLOXGNSS::getTIMTPAsEpoch(uint32_t µsecond, uint16_t maxWait) uint32_t us = packetUBXTIMTP->data.towMS % 1000; // Extract the milliseconds us *= 1000; // Convert to microseconds - double subMS = packetUBXTIMTP->data.towSubMS; // Get towSubMS (ms * 2^-32) - subMS *= pow(2.0, -32.0); // Convert to milliseconds - subMS *= 1000; // Convert to microseconds + double subMS = packetUBXTIMTP->data.towSubMS; // Get towSubMS (ms * 2^-32) + subMS *= 2.3283064365386963e-10; // pow(2.0, -32.0); // Convert to milliseconds + subMS *= 1000; // Convert to microseconds us += (uint32_t)subMS; // Add subMS