Skip to content

Commit 729f5cc

Browse files
authored
Merge pull request #60 from HanfG/main
Improve performance, use const instead of pow function.
2 parents 826c31e + b6aa2fc commit 729f5cc

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)