Skip to content

Commit f075a5e

Browse files
committed
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é <[email protected]>
1 parent 88b108d commit f075a5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/posix/options/clock_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ int z_vrfy___posix_clock_get_base(clockid_t clock_id, struct timespec *ts)
5959

6060
int z_clock_gettime(clockid_t clock_id, struct timespec *ts)
6161
{
62-
struct timespec base;
62+
struct timespec base = {0};
6363

6464
switch (clock_id) {
6565
case CLOCK_MONOTONIC:

0 commit comments

Comments
 (0)