summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/rtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/rtc.c')
-rw-r--r--firmware/target/hosted/rtc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/firmware/target/hosted/rtc.c b/firmware/target/hosted/rtc.c
index e747aece38..05c8f75ef7 100644
--- a/firmware/target/hosted/rtc.c
+++ b/firmware/target/hosted/rtc.c
@@ -54,6 +54,9 @@ int rtc_write_datetime(const struct tm *tm)
tv.tv_sec = mktime((struct tm *)tm);
tv.tv_usec = 0;
+ if ((int)tv.tv_sec == -1)
+ return -1;
+
/* set system clock */
settimeofday(&tv, NULL);