March-19th-2021, 02:58 PM
(This post was last modified: March-20th-2021, 08:24 AM by Armin@netPI.)
Well right now I have no idea how to do it. Setting the time was for me always a task for the Linux OS running in the background and its related services doing this job.
Correct is that the RTC chip PCF8563 used in netPI is connected to the I2C-1 bus of the main CPU and keeps the clock running for 7 days due to the supercapacitor based buffering on power outages. Each time the Linux is booted the clock register of this chip is read one time and copied to the Linux local time register. Of course in case you configured an NTP server then the time is resychronized with this server instead.
In summary I have not collected any experience ever how to change a system time within a container. So this time I have no answer ready. I could be that cause of the security restriction a container is never allowed to change the system time by any default commands.
The badest solution I can think of is mapping the I2C-1 bus directly into a container and access the RTC chip directly. This is possible but in my opinion a very bad idea since you just chance the clock in the chip but not in Linux overall. And this method needs definitively knowledge about c-programming or python etc which you do not have.
The very official command to set the RTC under normal Linux is "hwclock" as it is described here https://www.geeksforgeeks.org/hwclock-co...hut%20down. You could test if this command works when you load a Raspbian container on netPI running in privileged mode and mapping the two devices "/dev/rtc" and /dev/rtc0" into the container. But I have never tried this.
Thx
Armin
Correct is that the RTC chip PCF8563 used in netPI is connected to the I2C-1 bus of the main CPU and keeps the clock running for 7 days due to the supercapacitor based buffering on power outages. Each time the Linux is booted the clock register of this chip is read one time and copied to the Linux local time register. Of course in case you configured an NTP server then the time is resychronized with this server instead.
In summary I have not collected any experience ever how to change a system time within a container. So this time I have no answer ready. I could be that cause of the security restriction a container is never allowed to change the system time by any default commands.
The badest solution I can think of is mapping the I2C-1 bus directly into a container and access the RTC chip directly. This is possible but in my opinion a very bad idea since you just chance the clock in the chip but not in Linux overall. And this method needs definitively knowledge about c-programming or python etc which you do not have.
The very official command to set the RTC under normal Linux is "hwclock" as it is described here https://www.geeksforgeeks.org/hwclock-co...hut%20down. You could test if this command works when you load a Raspbian container on netPI running in privileged mode and mapping the two devices "/dev/rtc" and /dev/rtc0" into the container. But I have never tried this.
Thx
Armin
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)