From ebd1ea70e13ced685fb0b83c4cfacfeded3bd280 Mon Sep 17 00:00:00 2001 From: Tomas Rivera Date: Sat, 2 May 2026 07:54:43 +0200 Subject: [PATCH] backup: fixed debugging --- src/utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils.c b/src/utils.c index 23b7039..3fc5cc4 100644 --- a/src/utils.c +++ b/src/utils.c @@ -202,9 +202,9 @@ void handleBackups(char **sourceDirectoryArray, const int sourceNumber, char **d if (endptr == line || (*endptr != '\n' && *endptr != '\0')) { error(1, "program", "Invalid timestamp in cache file: %s", line); } - - if (difftime(now, lastBackupTime) > interval) { - debug("(difftime) %d is greater than (interval) %d -> backuping...", difftime(now, lastBackupTime), interval); + double deltaTime = difftime(now, lastBackupTime); + if (deltaTime > interval) { + debug("(difftime) %f is greater than (interval) %d -> backuping...", deltaTime, interval); shouldBackup = 1; cacheFile = fopen(cacheFilePATH, "w"); if (!cacheFile) { @@ -213,7 +213,7 @@ void handleBackups(char **sourceDirectoryArray, const int sourceNumber, char **d fprintf(cacheFile, "%ld\n", (long)now); fclose(cacheFile); } else { - debug("(difftime) %d is smaller than (interval) %d -> no need to backup.", difftime(now, lastBackupTime), interval); + debug("(difftime) %f is smaller than (interval) %d -> no need to backup.", deltaTime, interval); } }