Skip to content

Commit

Permalink
fix checking if rtc time is greater than system time
Browse files Browse the repository at this point in the history
  • Loading branch information
amurzeau committed Jul 9, 2022
1 parent 41bdd9d commit ac1dd8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void update_system_time() {
(unsigned long long) ts.tv_sec);


if(time(NULL) < ts.tv_sec + 2) {
if(time(NULL) + 2 >= ts.tv_sec) {
// Don't make the system time go backward, this can cause applications crashes/aborts
// We use a margin of 2s to check it
fprintf(stderr, "Not updating system time to avoid going backward in the past\n");
Expand Down

0 comments on commit ac1dd8e

Please sign in to comment.