* defs.h (ts_min, ts_max): New declarations.
* util.c (ts_min, ts_max): New functions.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
extern void ts_sub(struct timespec *, const struct timespec *, const struct timespec *);
extern void ts_mul(struct timespec *, const struct timespec *, int);
extern void ts_div(struct timespec *, const struct timespec *, int);
+extern const struct timespec *ts_min(const struct timespec *, const struct timespec *);
+extern const struct timespec *ts_max(const struct timespec *, const struct timespec *);
extern int parse_ts(const char *s, struct timespec *t);
# ifdef ENABLE_STACKTRACE
tv->tv_nsec = nsec % 1000000000;
}
+const struct timespec *
+ts_min(const struct timespec *a, const struct timespec *b)
+{
+ return ts_cmp(a, b) < 0 ? a : b;
+}
+
+const struct timespec *
+ts_max(const struct timespec *a, const struct timespec *b)
+{
+ return ts_cmp(a, b) > 0 ? a : b;
+}
+
int
parse_ts(const char *s, struct timespec *t)
{