diff options
author | Oskar <[email protected]> | 2024-07-16 18:09:08 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-07-16 18:09:08 +0200 |
commit | 730e03e60740905f3c97bed11db637e3dff2801a (patch) | |
tree | e0c259c1e6ff715589480d27daa674c5cc4aa31c | |
parent | d11ab78e83b8cdff9e49da3edb79309643dbadc2 (diff) |
function to check if it has been long enough
-rw-r--r-- | trashsys.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -787,6 +787,26 @@ int clear_all_files (char *paths, const int mode) { return FUNCTION_SUCCESS; } +int compare_unixtime (time_t deleted_time, int difference_in_days) { + + time_t diff_converted; + time_t current_time; + time_t final; + diff_converted = (time_t)difference_in_days * 86400; + current_time = time(NULL); + if(current_time == -1) { + return FUNCTION_FAILURE; + } + + final = current_time - deleted_time; + if(final < diff_converted) { + printf("failure\n"); + return FUNCTION_FAILURE; + } + printf("success\n"); + return FUNCTION_SUCCESS; +} + int main (int argc, char *argv[]) { if (argc == 1) { |