Skip to content

sync clock and time commands will fail on repeater if repeaters clock is in future #1332

@do6uk

Description

@do6uk

How ever this could happen ... if repeaters clock gone in future time, you will not be able to correct this without cutting of power-suply including battery and solar-power. The firmware doesn't accept to correct the clock backwards.

I suggest to apply the following change in the firmware - file CommonCLI.cpp ...

    } else if (memcmp(command, "time ", 5) == 0) {  // set time (to epoch seconds)
      uint32_t secs = _atoi(&command[5]);
      uint32_t curr = getRTCClock()->getCurrentTime();
      if (secs > curr) {
        getRTCClock()->setCurrentTime(secs);
        uint32_t now = getRTCClock()->getCurrentTime();
        DateTime dt = DateTime(now);
        sprintf(reply, "OK - clock set: %02d:%02d - %d/%d/%d UTC", dt.hour(), dt.minute(), dt.day(), dt.month(), dt.yea>
      } else if (secs == 0) {
        getRTCClock()->setCurrentTime(1767225600);
        uint32_t now = getRTCClock()->getCurrentTime();
        DateTime dt = DateTime(now);
        sprintf(reply, "OK - clock RESET: %02d:%02d - %d/%d/%d UTC", dt.hour(), dt.minute(), dt.day(), dt.month(), dt.y>
      } else {
        strcpy(reply, "(ERR: clock cannot go backwards)");
      }

after this change admins can reset repeaters clock by sending time 0 as a command to a epoch-time in past.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions