Skip to content

Commit b6aa2fc

Browse files
committed
Improve performance, use const instead of pow function.
1 parent 4ac1a71 commit b6aa2fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/u-blox_GNSS.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -18477,9 +18477,9 @@ uint32_t DevUBLOXGNSS::getTIMTPAsEpoch(uint32_t &microsecond, uint16_t maxWait)
1847718477
uint32_t us = packetUBXTIMTP->data.towMS % 1000; // Extract the milliseconds
1847818478
us *= 1000; // Convert to microseconds
1847918479

18480-
double subMS = packetUBXTIMTP->data.towSubMS; // Get towSubMS (ms * 2^-32)
18481-
subMS *= pow(2.0, -32.0); // Convert to milliseconds
18482-
subMS *= 1000; // Convert to microseconds
18480+
double subMS = packetUBXTIMTP->data.towSubMS; // Get towSubMS (ms * 2^-32)
18481+
subMS *= 2.3283064365386963e-10; // pow(2.0, -32.0); // Convert to milliseconds
18482+
subMS *= 1000; // Convert to microseconds
1848318483

1848418484
us += (uint32_t)subMS; // Add subMS
1848518485

0 commit comments

Comments
 (0)