diff options
author | João Valverde <j@v6e.pt> | 2021-12-27 02:03:26 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2021-12-27 14:07:32 +0000 |
commit | 0d5bfd44a87e4648cd159e56f4b8ca7cd8d73b57 (patch) | |
tree | 0399367c67c75d621420715bbf6f5046572511ff /wsutil/time_util.h | |
parent | b83cefd2fe9bfaad04542c14cbf8b1e2c6ed5454 (diff) |
Use a wrapper function to call strptime()
Encapsulate the feature requirements for strptime() in a
portability wrapper.
Use _GNU_SOURCE to expose strptime. It should be enough on glibc
without the side-effect of selecting a particular SUS version,
which we don't need and might hide other definitions.
Diffstat (limited to 'wsutil/time_util.h')
-rw-r--r-- | wsutil/time_util.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/wsutil/time_util.h b/wsutil/time_util.h index 5f93b7dde0..6002b1587d 100644 --- a/wsutil/time_util.h +++ b/wsutil/time_util.h @@ -10,8 +10,7 @@ #ifndef __TIME_UTIL_H__ #define __TIME_UTIL_H__ -#include "ws_symbol_export.h" - +#include <wireshark.h> #include <time.h> #ifdef __cplusplus @@ -66,6 +65,12 @@ guint64 create_timestamp(void); WS_DLL_PUBLIC struct timespec *ws_clock_get_realtime(struct timespec *ts); +/* + * Portability wrapper around strptime(). + */ +WS_DLL_PUBLIC +char *ws_strptime(const char *s, const char *format, struct tm *tm); + #ifdef __cplusplus } #endif /* __cplusplus */ |