/usr/include/dovecot/time-util.h is in dovecot-dev 1:2.2.22-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #ifndef TIME_UTIL_H
#define TIME_UTIL_H
#include <sys/time.h> /* for struct timeval */
/* Returns -1 if tv1<tv2, 1 if tv1>tv2, 0 if they're equal. */
int timeval_cmp(const struct timeval *tv1, const struct timeval *tv2);
/* Same as timeval_cmp, but tv->usecs must differ by at least usec_margin */
int timeval_cmp_margin(const struct timeval *tv1, const struct timeval *tv2,
unsigned int usec_margin);
/* Returns tv1-tv2 in milliseconds. */
int timeval_diff_msecs(const struct timeval *tv1, const struct timeval *tv2);
/* Returns tv1-tv2 in microseconds. */
long long timeval_diff_usecs(const struct timeval *tv1,
const struct timeval *tv2);
static inline void
timeval_add_msecs(struct timeval *tv, unsigned int msecs)
{
tv->tv_sec += msecs / 1000;
tv->tv_usec += (msecs % 1000) * 1000;
if (tv->tv_usec >= 1000000) {
tv->tv_sec++;
tv->tv_usec -= 1000000;
}
}
static inline void
timeval_sub_msecs(struct timeval *tv, unsigned int msecs)
{
tv->tv_sec -= msecs / 1000;
tv->tv_usec -= (msecs % 1000) * 1000;
if (tv->tv_usec < 0) {
tv->tv_sec--;
tv->tv_usec += 1000000;
}
}
/* Wrapper to strftime() */
const char *t_strflocaltime(const char *fmt, time_t t) ATTR_STRFTIME(1);
#endif
|