7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainen/* Returns -1 if tv1<tv2, 1 if tv1>tv2, 0 if they're equal. */
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainenint timeval_cmp(const struct timeval *tv1, const struct timeval *tv2);
e28b88ee83b47dc2257140600f491482704c7b79Stephan Bosch/* Same as timeval_cmp, but tv->usecs must differ by at least usec_margin */
e28b88ee83b47dc2257140600f491482704c7b79Stephan Boschint timeval_cmp_margin(const struct timeval *tv1, const struct timeval *tv2,
e28b88ee83b47dc2257140600f491482704c7b79Stephan Bosch unsigned int usec_margin);
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainen/* Returns tv1-tv2 in milliseconds. */
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainenint timeval_diff_msecs(const struct timeval *tv1, const struct timeval *tv2);
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainen/* Returns tv1-tv2 in microseconds. */
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainenlong long timeval_diff_usecs(const struct timeval *tv1,
2753f93e5d9cd5fbd773540de3772d182fcced5eStephan Boschstatic inline void
2753f93e5d9cd5fbd773540de3772d182fcced5eStephan Boschtimeval_add_msecs(struct timeval *tv, unsigned int msecs)
2753f93e5d9cd5fbd773540de3772d182fcced5eStephan Boschstatic inline void
2753f93e5d9cd5fbd773540de3772d182fcced5eStephan Boschtimeval_sub_msecs(struct timeval *tv, unsigned int msecs)
27a33f6aaa3d02d88c020315ae613e0c4910e950Timo Sirainen/* Convert t to local time and return timestamp on that day at 00:00:00. */
9983cbb4cef92d68ffde87dcc91913cc2fed3da5Martti Rannanjärvi/* Wrappers to strftime() */
9983cbb4cef92d68ffde87dcc91913cc2fed3da5Martti Rannanjärviconst char *t_strftime(const char *fmt, const struct tm *tm) ATTR_STRFTIME(1);
c3c07d6527ad28c8546cbbf84c257d178e23c184Timo Sirainenconst char *t_strflocaltime(const char *fmt, time_t t) ATTR_STRFTIME(1);
9983cbb4cef92d68ffde87dcc91913cc2fed3da5Martti Rannanjärviconst char *t_strfgmtime(const char *fmt, time_t t) ATTR_STRFTIME(1);