aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-06-07 17:16:01 +0200
committerTobias Brunner <tobias@strongswan.org>2011-06-07 17:52:34 +0200
commit876961cf0e4edb4708aea359a578b053d6e6d5b0 (patch)
treeafd5a886ee2f7ef54787237c3a7888ccd96e375b /src/libstrongswan/utils.c
parent1b185ea490761aadf75d995adb54358107c81ecc (diff)
downloadstrongswan-876961cf0e4edb4708aea359a578b053d6e6d5b0.tar.bz2
strongswan-876961cf0e4edb4708aea359a578b053d6e6d5b0.tar.xz
Properly print time differences.
time_t is not necessarily of type int.
Diffstat (limited to 'src/libstrongswan/utils.c')
-rw-r--r--src/libstrongswan/utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstrongswan/utils.c b/src/libstrongswan/utils.c
index 6ffb62aaf..1129ea3a6 100644
--- a/src/libstrongswan/utils.c
+++ b/src/libstrongswan/utils.c
@@ -20,6 +20,7 @@
#include <string.h>
#include <stdio.h>
#include <unistd.h>
+#include <inttypes.h>
#include <stdint.h>
#include <limits.h>
#include <dirent.h>
@@ -342,7 +343,7 @@ int time_delta_printf_hook(char *dst, size_t len, printf_hook_spec_t *spec,
char* unit = "second";
time_t *arg1 = *((time_t**)(args[0]));
time_t *arg2 = *((time_t**)(args[1]));
- time_t delta = abs(*arg1 - *arg2);
+ u_int64_t delta = llabs(*arg1 - *arg2);
if (delta > 2 * 60 * 60 * 24)
{
@@ -359,7 +360,8 @@ int time_delta_printf_hook(char *dst, size_t len, printf_hook_spec_t *spec,
delta /= 60;
unit = "minute";
}
- return print_in_hook(dst, len, "%d %s%s", delta, unit, (delta == 1)? "":"s");
+ return print_in_hook(dst, len, "%" PRIu64 " %s%s", delta, unit,
+ (delta == 1) ? "" : "s");
}
/**