Mercurial > dovecot > core-2.2
changeset 21855:d9283deab5d1
lib-index: Use time_to_local_day_start() instead of reimplementing
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 28 Mar 2017 19:40:27 +0300 |
parents | 3ffd4442b22c |
children | a0112b13e73c |
files | src/lib-index/mail-index-transaction-update.c |
diffstat | 1 files changed, 2 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-transaction-update.c Tue Mar 28 19:14:00 2017 +0300 +++ b/src/lib-index/mail-index-transaction-update.c Tue Mar 28 19:40:27 2017 +0300 @@ -6,11 +6,10 @@ #include "lib.h" #include "array.h" +#include "time-util.h" #include "mail-index-private.h" #include "mail-index-transaction-private.h" -#include <time.h> - static bool mail_index_transaction_has_ext_changes(struct mail_index_transaction *t); @@ -123,23 +122,13 @@ struct mail_index_header hdr; const struct mail_index_record *rec; const int max_days = N_ELEMENTS(hdr.day_first_uid); - const struct tm *day_tm; - struct tm tm; time_t stamp; int i, days; hdr = *mail_index_get_header(t->view); rec = array_idx(&t->appends, 0); - /* get beginning of today */ - day_tm = localtime(&day_stamp); - i_zero(&tm); - tm.tm_year = day_tm->tm_year; - tm.tm_mon = day_tm->tm_mon; - tm.tm_mday = day_tm->tm_mday; - stamp = mktime(&tm); - i_assert(stamp != (time_t)-1); - + stamp = time_to_local_day_start(day_stamp); if ((time_t)hdr.day_stamp >= stamp) return;