Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177629302
D55791.1794887039.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
814 B
Referenced Files
None
Subscribers
None
D55791.1794887039.diff
View Options
diff --git a/sys/sys/time.h b/sys/sys/time.h
--- a/sys/sys/time.h
+++ b/sys/sys/time.h
@@ -352,6 +352,16 @@
return (((sbintime_t)_ts.tv_sec << 32) + nstosbt(_ts.tv_nsec));
}
+static __inline sbintime_t
+tstosbt_sat(struct timespec _ts)
+{
+ if (_ts.tv_sec > SBT_MAX >> 32)
+ return (SBT_MAX);
+ if (_ts.tv_sec < -(SBT_MAX >> 32) - 1)
+ return (-SBT_MAX - 1);
+ return (tstosbt(_ts));
+}
+
static __inline struct timeval
sbttotv(sbintime_t _sbt)
{
@@ -368,6 +378,17 @@
return (((sbintime_t)_tv.tv_sec << 32) + ustosbt(_tv.tv_usec));
}
+
+static __inline sbintime_t
+tvtosbt_sat(struct timeval _tv)
+{
+ if (_tv.tv_sec > SBT_MAX >> 32)
+ return (SBT_MAX);
+ if (_tv.tv_sec < -(SBT_MAX >> 32) - 1)
+ return (-SBT_MAX - 1);
+ return (tvtosbt(_tv));
+}
+
#endif /* __BSD_VISIBLE */
#ifdef _KERNEL
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 17, 3:43 AM (18 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41792414
Default Alt Text
D55791.1794887039.diff (814 B)
Attached To
Mode
D55791: sys/time: Add saturating sbt conversions
Attached
Detach File
Event Timeline