time-util.c revision 2454dfa32c93c20a8522c6ed42fe057baaac9f9a
2454dfa32c93c20a8522c6ed42fe057baaac9f9aStephan Bosch/* Copyright (c) 2008-2017 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,
8bca5ef713f2916dbd60bb2b76e7cc06f4800d4dStephan Bosch if ((tv2->tv_usec - tv1->tv_usec) > (int)usec_margin)
8bca5ef713f2916dbd60bb2b76e7cc06f4800d4dStephan Bosch if ((tv1->tv_usec - tv2->tv_usec) > (int)usec_margin)
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)