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

Fix debug step-timeout-print for 32-bit platforms #557

Merged
merged 1 commit into from
Mar 23, 2021

Conversation

mlasch
Copy link
Contributor

@mlasch mlasch commented Mar 22, 2021

Current debug prints of timeout between lwm2m steps assume time_t to be
64-bit. However, on MIPS and ARM this is not always given. This fix will decide
at build time whether a 32-bit or 64-bit print format is needed.

This was tested on:

  • Linux x86_64 (64-bit)
  • Linux armv5e (32-bit)
  • Linux mips32r2el-24kc-nf (32-bit)

Signed-off-by: Marc Lasch marc.lasch@husqvarnagroup.com

@sbertin-telular
Copy link
Contributor

__TIMESIZE seems to be glibc specific. Since these are always timeouts in seconds, I would suggest LOG_ARG("timeoutP: %d", (int)*timeoutP);

core/liblwm2m.c Outdated
@@ -378,7 +378,8 @@ int lwm2m_step(lwm2m_context_t * contextP,
{
time_t tv_sec;

LOG_ARG("timeoutP: %" PRId64, *timeoutP);
LOG_ARG("timeoutP: %d", *timeoutP);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a type cast to int. (int)*timeoutP

@mlasch
Copy link
Contributor Author

mlasch commented Mar 22, 2021

Changed it now. I was concerned there may be an issue on Windows, but I cannot test except with compiler explorer (https://godbolt.org).

Current debug prints of timeout between lwm2m steps assume time_t to be
64-bit. However, on MIPS and ARM this is not always given. This fix
print the timeout number independently of the target architecture.

Signed-off-by: Marc Lasch <marc.lasch@husqvarnagroup.com>
@sbernard31 sbernard31 merged commit 84529a3 into eclipse-wakaama:master Mar 23, 2021
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

Successfully merging this pull request may close these issues.

None yet

3 participants