[riot-notifications] [RIOT-OS/RIOT] cpu/native/periph/timer: fix type conversion (#10783)

Kaspar Schleiser notifications at github.com
Wed Jan 16 15:22:03 CET 2019

### Contribution description

Depending on the definition of time_t, a calculation returning unsigned long would use signed long as intermediary type, causing undefined behaviour for some inputs.

This PR helps by explicitly casting.

### Testing procedure

Previous behaviour relied on two's compliment wrap, which apparently worked by chance. Anyhow, running the CI tests on native should be sufficient.

### Issues/PRs references

Found using #10782.
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * cpu/native/periph/timer: fix undefined behaviour

-- File Changes --

    M cpu/native/periph/timer.c (2)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190116/2c0c1df6/attachment.html>

More information about the notifications mailing list