diff options
author | Nick Van Doorn <vandoorn.nick@gmail.com> | 2018-01-30 09:27:08 -0800 |
---|---|---|
committer | Nick Van Doorn <vandoorn.nick@gmail.com> | 2018-01-30 09:27:08 -0800 |
commit | 1e37dad1fc37f7626fa0c83441940bab673ef4c5 (patch) | |
tree | f97413922fedcd4a048a17eec5d6f0fc5e2574d0 | |
parent | 9ae96091978fe5f2fcd64a9b7103ba61b9ed6f18 (diff) |
Add helper to get mtime of file
-rw-r--r-- | util.c | 10 | ||||
-rw-r--r-- | util.h | 1 |
2 files changed, 11 insertions, 0 deletions
@@ -126,6 +126,16 @@ int util_getUnixDatetime () { } /** + * Get the last modified datetime + * of the file at path + */ +time_t util_getMTime (char *path) { + struct stat st; + if (stat(path, &st) != 0) return -1; + else return st.st_mtime; +} + +/** * Convenience function to get current time as uint64_t. * * @return @@ -35,6 +35,7 @@ void delayMilli (unsigned long millisecs); long getTimeMicrosecs (); uint64_t GetCurrentTimestamp (void); +time_t util_getMTime (char *path); int util_getUnixDatetime (); le_result_t util_flattenRes (le_result_t *res, int nRes); |