From 9fc5db7b39ba4962866bf225eb9611dfe09a89ba Mon Sep 17 00:00:00 2001 From: ligd Date: Mon, 26 Aug 2019 10:02:48 -0600 Subject: [PATCH] drivers/timers/rtc: If the RTC time is successfully set, then update the current system time to match. --- drivers/timers/rtc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/timers/rtc.c b/drivers/timers/rtc.c index 01c7a6285a..f671c73507 100644 --- a/drivers/timers/rtc.c +++ b/drivers/timers/rtc.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/timers/rtc.c * - * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2017, 2019 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,7 @@ #include #include +#include #include #include @@ -412,6 +413,14 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) if (ops->settime) { ret = ops->settime(upper->lower, rtctime); + if (ret >= 0) + { + /* If the RTC time was set successfully, then update the + * current system time to match. + */ + + clock_synchronize(); + } } } break;