From d74271f00d9e8ad97b4bbd25eb674f5c1ae1fa4c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 1 Nov 2014 16:20:29 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7445 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/rtc.h | 3 ++- os/hal/src/rtc.c | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'os') diff --git a/os/hal/include/rtc.h b/os/hal/include/rtc.h index a0f02b502..626fd9f90 100644 --- a/os/hal/include/rtc.h +++ b/os/hal/include/rtc.h @@ -128,7 +128,8 @@ extern "C" { void rtcConvertDateTimeToStructTm(const RTCDateTime *timespec, struct tm *timp); void rtcConvertStructTmToDateTime(const struct tm *timp, - uint32_t tv_msec, RTCDateTime *timespec); + uint32_t tv_msec, + RTCDateTime *timespec); uint32_t rtcConvertDateTimeToFAT(const RTCDateTime *timespec); #ifdef __cplusplus } diff --git a/os/hal/src/rtc.c b/os/hal/src/rtc.c index 63a9a8b3e..b6d212e64 100644 --- a/os/hal/src/rtc.c +++ b/os/hal/src/rtc.c @@ -46,6 +46,13 @@ /* Driver local variables and types. */ /*===========================================================================*/ +/* + * Lookup table with months' length + */ +static const uint8_t month_len[12] = { + 31, 30, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; + /*===========================================================================*/ /* Driver local functions. */ /*===========================================================================*/ @@ -194,7 +201,7 @@ void rtcSetCallback(RTCDriver *rtcp, rtccb_t callback) { * @api */ void rtcConvertDateTimeToStructTm(const RTCDateTime *timespec, - struct tm *timp) { + struct tm *timp) { uint32_t tmp; timp->tm_year = timespec->year + (1980 - 1900); @@ -220,7 +227,8 @@ void rtcConvertDateTimeToStructTm(const RTCDateTime *timespec, * @api */ void rtcConvertStructTmToDateTime(const struct tm *timp, - uint32_t tv_msec, RTCDateTime *timespec) { + uint32_t tv_msec, + RTCDateTime *timespec) { timespec->year = timp->tm_year - (1980 - 1900); timespec->month = timp->tm_mon + 1; @@ -234,13 +242,6 @@ void rtcConvertStructTmToDateTime(const struct tm *timp, (timp->tm_hour * 3600 + timp->tm_min * 60 + timp->tm_sec) * 1000; } -/* - * Lookup table with months' length - */ -static const uint8_t month_len[12] = { - 31, 30, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 -}; - /** * @brief Get current time in format suitable for usage in FAT file system. * @note The information about day of week and DST is lost in DOS -- cgit v1.2.3