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

teleserver: reduces teleloger-timestamp(ticks) from 64bit-->32bit and overflows every 2 weeks #168

Open
ankostis opened this issue Nov 11, 2022 · 0 comments

Comments

@ankostis
Copy link

(i'm surprised nobody else has reported this)

The telelogger (v5) transmits uint64 for timestamps from CPU ticks

netbuf.dispatch(buf, sprintf(buf, "TS=%lu", millis()));

but teleserver although it uses atol() to parse it back, it assigns the result in a uint32(!):
uint32_t deviceTick;

uint32_t deviceTick = 0;

else if (!strncmp(s, "TS=", 3)) {
deviceTick = atol(s + 3);
}

Indeed we have noticed that device-ticks overflow at random durations, roughly before ~20 days (31bits correspond to ~25days, 32-->49days).

Q1: is this analysis correct?
Q2: (if yes) is this on purpose?
Q3: (if no) would you accept a PR to fix it?

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

1 participant