Mercurial > dovecot > core-2.2
changeset 21750:2ce0a606fd23
lib-index: Minor fix to day_first_uid updating
mktime() was getting a bit confused around day changes. Giving it only
year/month/day makes it less confused.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Sun, 26 Feb 2017 16:09:13 +0200 |
parents | ddf64cb23295 |
children | dc989aeb7299 |
files | src/lib-index/mail-index-transaction-update.c |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-transaction-update.c Sat Mar 11 19:20:30 2017 +0200 +++ b/src/lib-index/mail-index-transaction-update.c Sun Feb 26 16:09:13 2017 +0200 @@ -123,6 +123,7 @@ 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; @@ -131,10 +132,11 @@ rec = array_idx(&t->appends, 0); /* get beginning of today */ - tm = *localtime(&day_stamp); - tm.tm_hour = 0; - tm.tm_min = 0; - tm.tm_sec = 0; + 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);