diff options
author | Martin Willi <martin@strongswan.org> | 2009-08-31 15:03:35 +0200 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2009-08-31 15:03:35 +0200 |
commit | 3f310c0d1f664f5811327c5a89b5d6c2f3e42bdc (patch) | |
tree | f49413d140adadc222c553b24dea6ea2a2577fed /src/libstrongswan/utils.h | |
parent | 1d39663f7a0bfd7399ea0db24e4190bdbf196c46 (diff) | |
download | strongswan-3f310c0d1f664f5811327c5a89b5d6c2f3e42bdc.tar.bz2 strongswan-3f310c0d1f664f5811327c5a89b5d6c2f3e42bdc.tar.xz |
implemented a monotonic timestamping function, unaffected from system time changes
Diffstat (limited to 'src/libstrongswan/utils.h')
-rw-r--r-- | src/libstrongswan/utils.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 5d273d272..6b0990f5e 100644 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -25,6 +25,7 @@ #include <sys/types.h> #include <stdlib.h> #include <stddef.h> +#include <sys/time.h> #include <enum.h> @@ -269,13 +270,25 @@ void *memstr(const void *haystack, const char *needle, size_t n); /** * Creates a directory and all required parent directories. * - * @param path path to the new directory - * @param mode permissions of the new directory/directories + * @param path path to the new directory + * @param mode permissions of the new directory/directories * @return TRUE on success */ bool mkdir_p(const char *path, mode_t mode); /** + * Get a timestamp from a monotonic time source. + * + * While the time()/gettimeofday() functions are affected by leap seconds + * and system time changes, this function returns ever increasing monotonic + * time stamps. + * + * @param tv timeval struct receiving monotonic timestamps, or NULL + * @return monotonic timestamp in seconds + */ +time_t time_monotonic(timeval_t *tv); + +/** * returns null */ void *return_null(); |