How would I go about changing the system date from inside my container? I have a lot of time-dependent code, and changing the system time is the easiest way to test things.
date -s "27 OCT 2017 7:44:00"
doesn’t persist.
Thanks,
Brad
How would I go about changing the system date from inside my container? I have a lot of time-dependent code, and changing the system time is the easiest way to test things.
date -s "27 OCT 2017 7:44:00"
doesn’t persist.
Thanks,
Brad
Hi, the devices are running the NTP service (systemd-timesync) to set up the correct time. I’m guessing that time syncing is the part that doesn’t make your changes stick.
Just tried it out, and in the host OS, I see in the logs I can see the systemd[1]: Time has been changed
entries that resets to the correct time after issuing the command you posted.
If you need to test with setting the time, would suggest the following:
.dev
version of resinOS for your development, which opens up the system more.dev
, you can log into the host OS using the resin-cli: for example resin local ssh --host <IP>
systemctl stop systemd-timesyncd
)Some extra notes: this will work only on your local network (due to the the resin local ssh
); and do not use .dev
devices in production, they are open access by default, only for development; changing the time might have effect on other parts of the system which is good to keep in mind when debugging.
Hope this helps!
Working great, thanks!