Skip to content
  • Simon Glass's avatar
    dm: rtc: Try to handle the localtime() race · 21ddac14
    Simon Glass authored and Tom Rini's avatar Tom Rini committed
    
    
    At present the sandbox timer uses localtime() which can jump around twice
    a year when daylight-saving time changes.
    
    It would be tricky to make use of gmtime() since we still need to present
    the time in local time, as seems to be required by U-Boot's RTC interface.
    
    The problem can only happen once, so use a loop to detect it and try
    again. This should be sufficient to detect either a change in the 'second'
    value, or a daylight-saving change. We can assume that the latter also
    incorporates a 'second' change, so there is no need to loop more than
    twice.
    
    Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
    21ddac14