[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

POSIX defines struct timeval in <sys/types.h>

From: Ori Sky Farrell
Subject: POSIX defines struct timeval in <sys/types.h>
Date: Sun, 05 Sep 2021 15:57:18 +0100
User-agent: Cyrus-JMAP/3.5.0-alpha0-1126-g6962059b07-fm-20210901.001-g6962059b

I've discovered a gap in POSIX compliance in lib/sh/strftime.c on the devel 
branch. POSIX mandates that the timeval struct be defined in <sys/time.h>, 
although as can be seen on Line 67 of the file in question, the file is only 
included here if the tm struct -- which POSIX mandates be defined in <time.h> 
-- is defined in <sys/time.h>.

The libc implementation I'm working with defines timeval in <sys/time.h> and tm 
in <time.h> as mandated by POSIX so here I encounter a compile failure on Line 

../../../bash-5.1/lib/sh/strftime.c: In function ‘strftime’:
../../../bash-5.1/lib/sh/strftime.c:193:17: error: storage size of ‘tv’ isn’t 
  struct timeval tv;

Please correct me if I'm wrong as I may have missed something in the POSIX spec 
that results in the definition of timeval being available from another header, 
although I believe that the fix for this should be to move the <sys/time.h> 
include on Line 69 outside the enclosing #if guard, as it should always be 
required for POSIX compliance.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]