posix: clock: fix maybe-uninitialized warning in z_clock_gettime
Compiler gets confused and thinks base may be used uninitialized. This shouldn't be possible, but to make the warning go away, initialize it. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
parent
0b9fce4612
commit
a3f658454a
1 changed files with 1 additions and 3 deletions
|
@ -59,12 +59,10 @@ int z_vrfy___posix_clock_get_base(clockid_t clock_id, struct timespec *ts)
|
|||
|
||||
int z_clock_gettime(clockid_t clock_id, struct timespec *ts)
|
||||
{
|
||||
struct timespec base;
|
||||
struct timespec base = {.tv_sec = 0, .tv_nsec = 0};
|
||||
|
||||
switch (clock_id) {
|
||||
case CLOCK_MONOTONIC:
|
||||
base.tv_sec = 0;
|
||||
base.tv_nsec = 0;
|
||||
break;
|
||||
|
||||
case CLOCK_REALTIME:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue