Index: share/man/man3/Makefile =================================================================== --- share/man/man3/Makefile +++ share/man/man3/Makefile @@ -299,6 +299,7 @@ stdarg.3 va_start.3 MLINKS+= timeradd.3 timerclear.3 \ timeradd.3 timercmp.3 \ + timeradd.3 timerisvalid.3 \ timeradd.3 timerisset.3 \ timeradd.3 timersub.3 \ timeradd.3 timespecadd.3 \ Index: share/man/man3/timeradd.3 =================================================================== --- share/man/man3/timeradd.3 +++ share/man/man3/timeradd.3 @@ -27,13 +27,14 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 2018 +.Dd June 30, 2020 .Dt TIMERADD 3 .Os .Sh NAME .Nm timeradd , .Nm timersub , .Nm timerclear , +.Nm timeisvalid, .Nm timerisset , .Nm timercmp , .Nm timespecadd , @@ -51,6 +52,8 @@ .Ft void .Fn timerclear "struct timeval *tvp" .Ft int +.Fn timerisvalid "struct timespec *a" +.Ft int .Fn timerisset "struct timeval *tvp" .Ft int .Fn timercmp "struct timeval *a" "struct timeval *b" CMP @@ -130,6 +133,11 @@ .Fn timespecclear initialize their argument to midnight (0 hour) January 1st, 1970 (the Epoch). .Pp +.Fn timerisvalid a +tests if the microsecond value in +.Fa a +is greater than or equal to zero and less than one million. +.Pp .Fn timerisset and .Fn timespecisset Index: sys/sys/time.h =================================================================== --- sys/sys/time.h +++ sys/sys/time.h @@ -434,6 +434,8 @@ (vvp)->tv_usec += 1000000; \ } \ } while (0) +#define timerisvalid(tvp) \ + ((tvp)->tv_usec >= 0 && (tvp)->tv_usec < 1000000) #endif /*