Skip to content

Commit

Permalink
It's nice to be on the right side of history
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Nov 23, 2024
1 parent 0240000 commit 9bf6125
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions targets/TARGET_RASPBERRYPI/TARGET_RP2040/rtc_api.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/* mbed Microcontroller Library
* Copyright (c) 2024, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#if DEVICE_RTC

#include "mbed_critical.h"
Expand Down Expand Up @@ -81,6 +98,8 @@ void rtc_write(time_t t)
// won't produce the expected result. I wasn't able to find any errata or anything documenting
// this behavior, but it's very consistent, and the RTC tests fail if the below block is removed.
// To fix the error, we just decrease the time by 1 second before writing it to the registers.
// Update 2024: This is now a known, if not officially acknowledged, errata:
// https://forums.raspberrypi.com/viewtopic.php?t=377876
if (t >= 1) {
t -= 1;
}
Expand Down

0 comments on commit 9bf6125

Please sign in to comment.