From 37387a8e2d49cca9d0629c3acfe3f15babbb0bf8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 16 Mar 2026 15:33:02 +0000 Subject: util/nvmutil: portable struct timeval Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'util') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index f5c588be..0f69d27a 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -221,7 +221,6 @@ also consider: #include #endif #include -#include #include #include @@ -360,6 +359,14 @@ static void run_cmd(size_t c); static void check_command_num(size_t c); static u8 valid_command(size_t c); +/* + * portable timeval + */ +struct x_st_timeval { + long tv_sec; + long tv_usec; +}; + /* * Helper functions for command: setmac */ @@ -373,7 +380,7 @@ static ushort hextonum(char ch_s); static ushort rhex(void); static ushort read_urandom(void); static ulong entropy_jitter(void); -static int x_i_gettimeofday(struct timeval *tv, void *tz); +static int x_i_gettimeofday(struct x_st_timeval *tv, void *tz); static void write_mac_part(size_t partnum); /* @@ -1349,7 +1356,7 @@ hextonum(char ch_s) static ushort rhex(void) { - struct timeval tv; + struct x_st_timeval tv; ulong mix; static ulong counter = 0; ushort r; @@ -1421,7 +1428,7 @@ read_urandom(void) static ulong entropy_jitter(void) { - struct timeval a, b; + struct x_st_timeval a, b; ulong mix = 0; long mix_diff; int i; @@ -1446,8 +1453,10 @@ entropy_jitter(void) return mix; } + + static int -x_i_gettimeofday(struct timeval *tv, void *tz) +x_i_gettimeofday(struct x_st_timeval *tv, void *tz) { time_t t; -- cgit v1.2.1