Avoid that gcc reports the following warning on NetBSD systems:
CC stat.o
stat.c: In function '__show_run_stats':
stat.c:1868: warning: dereferencing type-punned pointer will break strict-aliasing rules
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
char time_buf[32];
struct timeval now;
unsigned long long ms_since_epoch;
+ time_t tv_sec;
gettimeofday(&now, NULL);
ms_since_epoch = (unsigned long long)(now.tv_sec) * 1000 +
(unsigned long long)(now.tv_usec) / 1000;
- os_ctime_r((const time_t *) &now.tv_sec, time_buf,
- sizeof(time_buf));
+ tv_sec = now.tv_sec;
+ os_ctime_r(&tv_sec, time_buf, sizeof(time_buf));
if (time_buf[strlen(time_buf) - 1] == '\n')
time_buf[strlen(time_buf) - 1] = '\0';