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

GPS Time overflow #6

Open
JhonattanC opened this issue Feb 29, 2020 · 1 comment
Open

GPS Time overflow #6

JhonattanC opened this issue Feb 29, 2020 · 1 comment

Comments

@JhonattanC
Copy link

JhonattanC commented Feb 29, 2020

Hi, in "mDotEvent.h" found that in this function:

virtual void ServerTime(uint32_t seconds, uint8_t sub_seconds) 
{
    logDebug("mDotEvent - ServerTime");
    ServerTimeReceived = true;

    uint64_t current_server_time_ms = static_cast<uint64_t>(seconds) * 1000 +
    static_cast<uint16_t>(sub_seconds) * 4 + _timeSinceTx.read_ms();

    ServerTimeSeconds = static_cast<uint32_t>(current_server_time_ms / 1000);
    ServerTimeMillis = static_cast<uint16_t>(current_server_time_ms % 1000);
}

The current_server_time_ms overflows when doing static_cast<uint64_t>(seconds) * 1000 so the time when parsing the GPS time to String is incorrect. I guess that the getGPSTime() function uses this too, so the time that returns that function is wrong too.

I modified the ServerTime function in my own RadioEvent classs, and found that is not a network server issue. I tested it with Thingpark and a xDot module.

@theckmts
Copy link

theckmts commented Mar 2, 2020

I have a couple questions to help reproduce this.

Could you provide an example of output you saw when this occurred?

What time do you receive in your modified ServerTime function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants