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 Wconversion errors #842

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/system/unix/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ unsigned long z_clock_elapsed_s(z_clock_t *instant) {
}

void z_clock_advance_us(z_clock_t *clock, unsigned long duration) {
clock->tv_sec += duration / 1000000;
clock->tv_nsec += (duration % 1000000) * 1000;
clock->tv_sec += (time_t)(duration / 1000000);
clock->tv_nsec += (long int)((duration % 1000000) * 1000);

if (clock->tv_nsec >= 1000000000) {
clock->tv_sec += 1;
Expand All @@ -221,16 +221,16 @@ void z_clock_advance_us(z_clock_t *clock, unsigned long duration) {
}

void z_clock_advance_ms(z_clock_t *clock, unsigned long duration) {
clock->tv_sec += duration / 1000;
clock->tv_nsec += (duration % 1000) * 1000000;
clock->tv_sec += (time_t)(duration / 1000);
clock->tv_nsec += (long int)((duration % 1000) * 1000000);

if (clock->tv_nsec >= 1000000000) {
clock->tv_sec += 1;
clock->tv_nsec -= 1000000000;
}
}

void z_clock_advance_s(z_clock_t *clock, unsigned long duration) { clock->tv_sec += duration; }
void z_clock_advance_s(z_clock_t *clock, unsigned long duration) { clock->tv_sec += (time_t)duration; }

/*------------------ Time ------------------*/
z_time_t z_time_now(void) {
Expand Down
Loading