Lines Matching +full:fraction +full:- +full:z
2 * timevalops.h -- calculations on 'struct timeval' values
28 * Convert usec to a time stamp fraction.
47 * Convert a time stamp fraction to microseconds. The time stamp
48 * fraction is assumed to be unsigned.
78 (ts)->l_ui = (u_long)(tv)->tv_sec; \
79 TVUTOTSF((tv)->tv_usec, (ts)->l_uf); \
86 (ts)->l_ui = (tv)->tv_sec; \
87 usec = (tv)->tv_usec; \
88 if (((tv)->tv_sec < 0) || ((tv)->tv_usec < 0)) { \
89 usec = -usec; \
90 (ts)->l_ui = -(ts)->l_ui; \
93 TVUTOTSF(usec, (ts)->l_uf); \
105 (tv)->tv_sec = (ts)->l_ui; \
106 TSFTOTVU((ts)->l_uf, (tv)->tv_usec); \
107 if ((tv)->tv_usec == 1000000) { \
108 (tv)->tv_sec++; \
109 (tv)->tv_usec = 0; \
119 ((x)->tv_usec >= 0 && (x)->tv_usec < MICROSECONDS)
122 * Convert milliseconds to a time stamp fraction. Unused except for
129 * predicate: returns TRUE if the microseconds are out-of-bounds
140 long z; in normalize_tval() local
143 * If the fraction becomes excessive denormal, we use division in normalize_tval()
148 * here: it has implementation-defined behaviour when applied in normalize_tval()
151 if (x.tv_usec < -3l * MICROSECONDS || in normalize_tval()
153 z = x.tv_usec / MICROSECONDS; in normalize_tval()
154 x.tv_usec -= z * MICROSECONDS; in normalize_tval()
155 x.tv_sec += z; in normalize_tval()
161 * mul-by-inverse trick is employed. (It also does the floor in normalize_tval()
167 x.tv_sec--; in normalize_tval()
171 x.tv_usec -= MICROSECONDS; in normalize_tval()
194 /* x = a + b, b is fraction only */
209 /* x = a - b */
219 x.tv_sec -= b.tv_sec; in sub_tval()
220 x.tv_usec -= b.tv_usec; in sub_tval()
225 /* x = a - b, b is fraction only */
235 x.tv_usec -= b; in sub_tval_us()
240 /* x = -a */
248 x.tv_sec = -a.tv_sec; in neg_tval()
249 x.tv_usec = -a.tv_usec; in neg_tval()
265 c.tv_sec = -c.tv_sec - 1; in abs_tval()
266 c.tv_usec = MICROSECONDS - c.tv_usec; in abs_tval()
268 c.tv_sec = -c.tv_sec; in abs_tval()
276 * compare previously-normalised a and b
277 * return 1 / 0 / -1 if a < / == / > b
287 r = (a.tv_sec > b.tv_sec) - (a.tv_sec < b.tv_sec); in cmp_tval()
289 r = (a.tv_usec > b.tv_usec) - in cmp_tval()
296 * compare possibly-denormal a and b
297 * return 1 / 0 / -1 if a < / == / > b
309 * test previously-normalised a
310 * return 1 / 0 / -1 if a < / == / > 0
319 r = (a.tv_sec > 0) - (a.tv_sec < 0); in test_tval()
327 * test possibly-denormal a
328 * return 1 / 0 / -1 if a < / == / > 0
395 out.tv_sec = -out.tv_sec; in lfp_intv_to_tval()
396 out.tv_usec = -out.tv_usec; in lfp_intv_to_tval()