aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/RTCv2
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-05-07 12:28:53 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-05-07 12:28:53 +0000
commitbd1bedbbf7502541cc6cf6b11faedc9acd03228c (patch)
treea258d66e5fc3f04405f466a0101276dc078b1c32 /os/hal/ports/STM32/LLD/RTCv2
parent6087f6342b25e5b51c4a43ec7ba21c0d319c61f6 (diff)
downloadChibiOS-bd1bedbbf7502541cc6cf6b11faedc9acd03228c.tar.gz
ChibiOS-bd1bedbbf7502541cc6cf6b11faedc9acd03228c.tar.bz2
ChibiOS-bd1bedbbf7502541cc6cf6b11faedc9acd03228c.zip
Fixed bug #591.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7954 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/STM32/LLD/RTCv2')
-rw-r--r--os/hal/ports/STM32/LLD/RTCv2/rtc_lld.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/os/hal/ports/STM32/LLD/RTCv2/rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv2/rtc_lld.c
index 940abef7e..51ee7c41c 100644
--- a/os/hal/ports/STM32/LLD/RTCv2/rtc_lld.c
+++ b/os/hal/ports/STM32/LLD/RTCv2/rtc_lld.c
@@ -392,7 +392,7 @@ void rtc_lld_get_time(RTCDriver *rtcp, RTCDateTime *timespec) {
/* If the RTC is capable of sub-second counting then the value is
normalized in milliseconds and added to the time.*/
#if STM32_RTC_HAS_SUBSECONDS
- subs = (((ssr << 16) / STM32_RTC_PRESS_VALUE) * 1000) >> 16;
+ subs = (((STM32_RTC_PRESS_VALUE - 1U) - ssr) * 1000U) / STM32_RTC_PRESS_VALUE;
#else
subs = 0;
#endif /* STM32_RTC_HAS_SUBSECONDS */