From 60a33ca726518a3325e56d77f65bfdcbecf91444 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 11 Feb 2020 22:20:57 -0500 Subject: Implement explicit reference times (-newerXt) --- util.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index e7b844e..ef546d4 100644 --- a/util.h +++ b/util.h @@ -170,6 +170,27 @@ char *xregerror(int err, const regex_t *regex); */ int xlocaltime(const time_t *timep, struct tm *result); +/** + * gmtime_r() wrapper that calls tzset() first. + * + * @param timep + * The time_t to convert. + * @param result + * Buffer to hold the result. + * @return 0 on success, -1 on failure. + */ +int xgmtime(const time_t *timep, struct tm *result); + +/** + * A portable timegm(), the inverse of gmtime(). + * + * @param tm + * The struct tm to convert. + * @return + * The converted time on success, or -1 on failure. + */ +time_t xtimegm(struct tm *tm); + /** * Format a mode like ls -l (e.g. -rw-r--r--). * -- cgit v1.2.3