Skip to content

Commit c335a00

Browse files
committed
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.
1 parent 6002bdd commit c335a00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

platform/mbed_rtc_time.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ time_t time(time_t *timer)
5353
}
5454
}
5555

56-
time_t t = 0;
56+
time_t t = -1;
5757
if (_rtc_read != NULL) {
5858
t = _rtc_read();
5959
}

0 commit comments

Comments
 (0)