From c335a0090ce542f4e91b1f5d1d01d5f3f27d4c4a Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Tue, 6 Jun 2017 23:03:28 +0100 Subject: [PATCH] rtc_time: Fix incorrect return value when the calendar is not available. According to the C99 specification "The value (time_t)(-1) is returned if the calendar time is not available". Before this patch, in such case the function was returning 0 instead of -1. --- platform/mbed_rtc_time.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mbed_rtc_time.cpp b/platform/mbed_rtc_time.cpp index 5f4b24a0eb..6f26fb27a8 100644 --- a/platform/mbed_rtc_time.cpp +++ b/platform/mbed_rtc_time.cpp @@ -53,7 +53,7 @@ time_t time(time_t *timer) } } - time_t t = 0; + time_t t = -1; if (_rtc_read != NULL) { t = _rtc_read(); }