Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance, use const instead of pow function. #60

Merged
merged 2 commits into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/u-blox_GNSS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18477,9 +18477,9 @@ uint32_t DevUBLOXGNSS::getTIMTPAsEpoch(uint32_t &microsecond, 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

Expand Down