mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
184:08ed48f1de7f
Parent:
167:e84263d55307
--- a/targets/TARGET_NXP/TARGET_LPC408X/rtc_api.c	Tue Mar 20 17:01:51 2018 +0000
+++ b/targets/TARGET_NXP/TARGET_LPC408X/rtc_api.c	Thu Apr 19 17:12:19 2018 +0100
@@ -88,7 +88,10 @@
     timeinfo.tm_year = LPC_RTC->YEAR - 1900;
     
     // Convert to timestamp
-    time_t t = _rtc_mktime(&timeinfo);
+    time_t t;
+    if (_rtc_maketime(&timeinfo, &t, RTC_4_YEAR_LEAP_YEAR_SUPPORT) == false) {
+        return 0;
+    }
     
     return t;
 }
@@ -96,10 +99,10 @@
 void rtc_write(time_t t) {
     // Convert the time in to a tm
     struct tm timeinfo;
-    if (_rtc_localtime(t, &timeinfo) == false) {
+    if (_rtc_localtime(t, &timeinfo, RTC_4_YEAR_LEAP_YEAR_SUPPORT) == false) {
         return;
     }
-    
+
     // Pause clock, and clear counter register (clears us count)
     LPC_RTC->CCR |= 2;