• Alessandro Rubini's avatar
    time-wrs: fix for a mishap when WR time starts at 0. · 4dbc6b0b
    Alessandro Rubini authored
    System time is used for log messages and nothing critical, so we'd
    better have it different from WR time, when WR time is clearly wrong.
    This commit avoids setting Unix time from WR time when WR time is
    clearly wrong (i.e. earlier than today).
    
    This, among other things, fixes a "fatal error" startup failure when
    two free-running WRS devices are turned one at the same time
    (noted by Adam Wujek).
    
    This is because the master was counting from zero and the slave,
    was setting system time accordingly; but the slave's boot procedure
    already used wr_date to set the utc/tai offset, and system time
    as a result  was being set to a negative value -- tai's being small,
    "tai - 35" was negative.
    Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
    4dbc6b0b
wrs-time.c 8.33 KB