diff options
Diffstat (limited to 'src/libstrongswan/library.c')
-rw-r--r-- | src/libstrongswan/library.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/libstrongswan/library.c b/src/libstrongswan/library.c index 9f96d119c..f66818bc2 100644 --- a/src/libstrongswan/library.c +++ b/src/libstrongswan/library.c @@ -150,11 +150,20 @@ static int print_time(FILE *stream, const struct printf_info *info, static int print_time_delta(FILE *stream, const struct printf_info *info, const void *const *args) { - time_t *start = *((time_t**)(args[0])); - time_t *end = *((time_t**)(args[1])); - u_int delta = abs(*end - *start); - char* unit = "second"; + time_t *arg1, *arg2; + time_t delta; + + arg1 = *((time_t**)(args[0])); + if (info->alt) + { + arg2 = *((time_t**)(args[1])); + delta = abs(*arg1 - *arg2); + } + else + { + delta = *arg1; + } if (delta > 2 * 60 * 60 * 24) { @@ -180,5 +189,5 @@ static int print_time_delta(FILE *stream, const struct printf_info *info, static void __attribute__ ((constructor))print_register() { register_printf_function(PRINTF_TIME, print_time, arginfo_ptr_alt_ptr_int); - register_printf_function(PRINTF_TIME_DELTA, print_time_delta, arginfo_ptr_ptr); + register_printf_function(PRINTF_TIME_DELTA, print_time_delta, arginfo_ptr_alt_ptr_ptr); } |