Re: [PATCH] rtc: rzn1: fix BCD to rtc_time conversion errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 13, 2024 at 12:30:32PM +0100, Wolfram Sang wrote:
> tm_mon describes months from 0 to 11, but the register contains BCD from
> 1 to 12. tm_year contains years since 1900, but the BCD contains 20XX.
> Apply the offsets when converting these numbers.
>
> Fixes: deeb4b5393e1 ("rtc: rzn1: Add new RTC driver")
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

Forgot to add that Biju Das had a nice test case for the months:

    Steps to reproduce:
    ------------------
    date -s "2016-12-31 23:59:55";hwclock -w
    hwclock; sleep 10; hwclock

    Original result:
    ---------------
    Sat Dec 31 23:59:55 UTC 2016
    Sat Dec 31 23:59:55 2016  0.000000 seconds
    hwclock: RTC_RD_TIME: Invalid argument

    Result after the fix:
    --------------------
    Sat Dec 31 23:59:55 2016  0.000000 seconds
    Sun Jan  1 00:00:05 2017  0.000000 seconds

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux