bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2008-2018 Dovecot authors, see the included COPYING file */
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainenint timeval_cmp(const struct timeval *tv1, const struct timeval *tv2)
e28b88ee83b47dc2257140600f491482704c7b79Stephan Boschint timeval_cmp_margin(const struct timeval *tv1, const struct timeval *tv2,
f0f2cc0a290310c398ca727b199e33ea9994b7bcStephan Bosch sec_margin = ((int)usec_margin / 1000000) + 1;
f0f2cc0a290310c398ca727b199e33ea9994b7bcStephan Bosch usecs_diff = (tv2->tv_sec - tv1->tv_sec) * 1000000ULL +
f0f2cc0a290310c398ca727b199e33ea9994b7bcStephan Bosch sec_margin = ((int)usec_margin / 1000000) + 1;
f0f2cc0a290310c398ca727b199e33ea9994b7bcStephan Bosch usecs_diff = (tv1->tv_sec - tv2->tv_sec) * 1000000ULL +
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainenint timeval_diff_msecs(const struct timeval *tv1, const struct timeval *tv2)
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainenlong long timeval_diff_usecs(const struct timeval *tv1,
9983cbb4cef92d68ffde87dcc91913cc2fed3da5Martti Rannanjärvistatic const char *strftime_real(const char *fmt, const struct tm *tm)
c3c07d6527ad28c8546cbbf84c257d178e23c184Timo Sirainen while ((ret = strftime(buf, bufsize, fmt, tm)) == 0) {
9983cbb4cef92d68ffde87dcc91913cc2fed3da5Martti Rannanjärviconst char *t_strftime(const char *fmt, const struct tm *tm)
9983cbb4cef92d68ffde87dcc91913cc2fed3da5Martti Rannanjärviconst char *t_strflocaltime(const char *fmt, time_t t)
9983cbb4cef92d68ffde87dcc91913cc2fed3da5Martti Rannanjärvi return strftime_real(fmt, localtime(&t));
9983cbb4cef92d68ffde87dcc91913cc2fed3da5Martti Rannanjärviconst char *t_strfgmtime(const char *fmt, time_t t)