set_relative_date was failing if the resulting date was in the previous
day.
This commit is contained in:
Yann Weber 2018-08-22 01:54:46 +02:00
commit 2b63e70596
3 changed files with 3 additions and 2 deletions

View file

@ -287,7 +287,7 @@ int _ttail_set_date_fmt(ttail_t*, char*, int);
*- -#2s
*- -#3Month
*@param ttail_t ttail instance
*@param char*[2] dates {min,max} both can be NULL
*@param char* date specifier
*@param int c the date id to handle
*@return -1 if error 0 else
*/

View file

@ -561,7 +561,7 @@ int _ttail_set_date_relative(ttail_t* res, char* date, int c)
{
mod = 1;
value = abs(tm->tm_hour);
tm->tm_hour = 23 - (value % 24);
tm->tm_hour = 24 - (value % 24);
value /= 24;
value++;
}

View file

@ -67,6 +67,7 @@ START_TEST (fmt_sec)
{"#-10s", 10}, {"#-142sec", 142}, {"#-4096s", 4096},
{"#-1m", 60}, {"#-10min", 600},
{"#-1h", 3600}, {"#-10h", 36000},
{"#-2h", 7200}, {"#-12h", 43200},
{"#-1d", 3600*24}, {"#-2day", 3600*24*2},
};