Browse Source

Fix #20

set_relative_date was failing if the resulting date was in the previous
day.
Yann Weber 5 years ago
parent
commit
2b63e70596
3 changed files with 3 additions and 2 deletions
  1. 1
    1
      src/include/ttail_init.h
  2. 1
    1
      src/ttail_init.c
  3. 1
    0
      tests/ttail_init_set_date_relative.c

+ 1
- 1
src/include/ttail_init.h View File

287
  *- -#2s
287
  *- -#2s
288
  *- -#3Month
288
  *- -#3Month
289
  *@param ttail_t ttail instance
289
  *@param ttail_t ttail instance
290
- *@param char*[2] dates {min,max} both can be NULL
290
+ *@param char* date specifier
291
  *@param int c the date id to handle
291
  *@param int c the date id to handle
292
  *@return -1 if error 0 else
292
  *@return -1 if error 0 else
293
  */
293
  */

+ 1
- 1
src/ttail_init.c View File

561
 				{
561
 				{
562
 					mod = 1;
562
 					mod = 1;
563
 					value = abs(tm->tm_hour);
563
 					value = abs(tm->tm_hour);
564
-					tm->tm_hour = 23 - (value % 24);
564
+					tm->tm_hour = 24 - (value % 24);
565
 					value /= 24;
565
 					value /= 24;
566
 					value++;
566
 					value++;
567
 				}
567
 				}

+ 1
- 0
tests/ttail_init_set_date_relative.c View File

67
 		{"#-10s", 10}, {"#-142sec", 142}, {"#-4096s", 4096},
67
 		{"#-10s", 10}, {"#-142sec", 142}, {"#-4096s", 4096},
68
 		{"#-1m", 60}, {"#-10min", 600},
68
 		{"#-1m", 60}, {"#-10min", 600},
69
 		{"#-1h", 3600}, {"#-10h", 36000},
69
 		{"#-1h", 3600}, {"#-10h", 36000},
70
+		{"#-2h", 7200}, {"#-12h", 43200},
70
 		{"#-1d", 3600*24}, {"#-2day", 3600*24*2},
71
 		{"#-1d", 3600*24}, {"#-2day", 3600*24*2},
71
 	};
72
 	};
72
 
73
 

Loading…
Cancel
Save