MCPcopy Index your code
hub / github.com/F-Stack/f-stack / sbttons

Function sbttons

freebsd/sys/time.h:184–199  ·  view source on GitHub ↗

* Decimal<->sbt conversions. Multiplying or dividing by SBT_1NS results in * large roundoff errors which sbttons() and nstosbt() avoid. Millisecond and * microsecond functions are also provided for completeness. * * These functions return the smallest sbt larger or equal to the * number of seconds requested so that sbttoX(Xtosbt(y)) == y. Unlike * top of second computations below, which r

Source from the content-addressed store, hash-verified

182 * assert.h.
183 */
184static __inline int64_t
185sbttons(sbintime_t _sbt)
186{
187 uint64_t ns;
188
189#ifdef KASSERT
190 KASSERT(_sbt >= 0, ("Negative values illegal for sbttons: %jx", _sbt));
191#endif
192 ns = _sbt;
193 if (ns >= SBT_1S)
194 ns = (ns >> 32) * 1000000000;
195 else
196 ns = 0;
197
198 return (ns + (1000000000 * (_sbt & 0xffffffffu) >> 32));
199}
200
201static __inline sbintime_t
202nstosbt(int64_t _ns)

Callers 1

sbttotsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected