mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
15 lines
335 B
C
15 lines
335 B
C
#include <timex.h>
|
|
|
|
timex_t timex_add(const timex_t a, const timex_t b) {
|
|
timex_t result;
|
|
result.seconds = a.seconds + b.seconds;
|
|
result.nanoseconds = a.nanoseconds + b.nanoseconds;
|
|
|
|
while (result.nanoseconds > 1000*1000) {
|
|
result.nanoseconds -= 1000*1000;
|
|
result.seconds++;
|
|
}
|
|
|
|
return result;
|
|
}
|