This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Align time types to SUSv3


Hi,

according to SUSv3, struct timeval is defined as

 struct timeval {
    time_t      tv_sec;
    suseconds_t tv_usec;
 };

see http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html

Additionally, useconds_t is defined as an unsigned type, and suseconds_t
as a signed type, see
http://www.opengroup.org/onlinepubs/007908799/xsh/systypes.h.html

I'd like to propose the below patch, which alignes newlib to SUSv3.


Corinna


	* libc/include/sys/time.h (struct timeval): Change member types
	according to SUSv3.
	* libc/include/sys/types.h (useconds_t): Change to unsigned
	according to SUSv3.
	(suseconds_t): Define type.

Index: libc/include/sys/time.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/time.h,v
retrieving revision 1.9
diff -u -p -r1.9 time.h
--- libc/include/sys/time.h  18 Nov 2005 16:08:10 -0000      1.9
+++ libc/include/sys/time.h  12 Feb 2006 13:03:56 -0000
@@ -14,8 +14,8 @@ extern "C" {
 
 #ifndef _WINSOCK_H
 struct timeval {
-  long tv_sec;
-  long tv_usec;
+  time_t      tv_sec;
+  suseconds_t tv_usec;
 };
 
 struct timezone {
Index: libc/include/sys/types.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/types.h,v
retrieving revision 1.22
diff -u -p -r1.22 types.h
--- libc/include/sys/types.h 8 Dec 2005 19:45:43 -0000       1.22
+++ libc/include/sys/types.h 12 Feb 2006 13:03:56 -0000
@@ -262,7 +262,8 @@ typedef _TIMER_T_ timer_t;
 #define __timer_t_defined
 #endif
 
-typedef long useconds_t;
+typedef unsigned long useconds_t;
+typedef long suseconds_t;
 
 #include <sys/features.h>
 

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]