[PATCH 2/7] Add timespecvalid_interval macro and use it.

Sebastian Huber <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
From: Dmitry Chagin <[email protected]>

Reviewed by:		jhb, imp (early rev)
Differential revision:	https://reviews.freebsd.org/D34848
MFC after:		2 weeks
---
 newlib/libc/include/sys/time.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h
index 4062df728..006d1f663 100644
--- a/newlib/libc/include/sys/time.h
+++ b/newlib/libc/include/sys/time.h
@@ -378,6 +378,8 @@ tvtosbt(struct timeval _tv)
 			(vsp)->tv_nsec += 1000000000L;			\
 		}							\
 	} while (0)
+#define	timespecvalid_interval(tsp)	((tsp)->tv_sec >= 0 &&		\
+	    (tsp)->tv_nsec >= 0 && (tsp)->tv_nsec < 1000000000L)
 
 #ifndef _KERNEL			/* NetBSD/OpenBSD compatible interfaces */
 
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.