util-time: Add function to convert timespec to epoch millis

pull/3157/head
Danny Browning 8 years ago committed by Victor Julien
parent e41acd3d05
commit aae50f8a7e

@ -593,3 +593,8 @@ uint64_t SCGetSecondsUntil (const char *str, time_t epoch)
return seconds;
}
uint64_t SCTimespecAsEpochMillis(const struct timespec* ts)
{
return ts->tv_sec * 1000L + ts->tv_nsec / 1000000L;
}

@ -62,6 +62,6 @@ int SCTimeToStringPattern (time_t epoch, const char *pattern, char *str,
size_t size);
uint64_t SCParseTimeSizeString (const char *str);
uint64_t SCGetSecondsUntil (const char *str, time_t epoch);
uint64_t SCTimespecAsEpochMillis(const struct timespec *ts);
#endif /* __UTIL_TIME_H__ */

Loading…
Cancel
Save