• Baolin Wang's avatar
    rtc: Add one offset seconds to expand RTC range · 98951564
    Baolin Wang authored
    From our investigation for all RTC drivers, 1 driver will be expired before
    year 2017, 7 drivers will be expired before year 2038, 23 drivers will be
    expired before year 2069, 72 drivers will be expired before 2100 and 104
    drivers will be expired before 2106. Especially for these early expired
    drivers, we need to expand the RTC range to make the RTC can still work
    after the expired year.
    
    So we can expand the RTC range by adding one offset to the time when reading
    from hardware, and subtracting it when writing back. For example, if you have
    an RTC that can do 100 years, and currently is configured to be based in
    Jan 1 1970, so it can represents times from 1970 to 2069. Then if you change
    the start year from 1970 to 2000, which means it can represents times from
    2000 to 2099. By adding or subtracting the offset produced by moving the wrap
    point, all times between 1970 and 1999 from RTC hardware could get interpreted
    as times from 2070 to 2099, but the interpretation of dates between 2000 and
    2069 would not change.
    Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
    Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
    98951564
class.c 13.6 KB