• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Access to RTC from my own container application
#2
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
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Messages In This Thread
Access to RTC from my own container application - by tad - March-19th-2021, 02:20 PM
RE: Access to RTC from my own container application - by Armin@netPI - March-19th-2021, 02:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Wi-fi in Access Point mode Renato75 7 4,658 June-3rd-2022, 12:59 PM
Last Post: Armin@netPI
  NetPI wifi access to WPA2-Enterprise MikeP 4 4,257 September-3rd-2021, 02:56 PM
Last Post: MikeP
  TOSILOCK for CONTAINER COswald 3 2,184 July-13th-2021, 11:32 AM
Last Post: Armin@netPI
  netPI RTE 3: access from several comm. masters tad 3 4,026 June-3rd-2021, 12:03 PM
Last Post: Armin@netPI
  [SOLVED] Starting services/commands/scripts at startup of a container Jonas.Sellmann@outlook.de 9 6,043 March-9th-2021, 08:47 AM
Last Post: WalterSchaefer
  OpenVPN container Armin@netPI 0 1,616 January-3rd-2021, 12:13 PM
Last Post: Armin@netPI
  operating Console of a container on netPI connected to Wi-Fi tethering tad 3 2,612 December-3rd-2020, 12:32 PM
Last Post: tad
  NIOT-E-NPIX-4DI4DO with netpi-netx container WalterSchaefer 3 6,484 November-25th-2020, 01:06 PM
Last Post: zen89
  NPIX-4DI4DO and NetPi-Nodered container issues alhammi 4 7,592 November-16th-2020, 01:35 PM
Last Post: alhammi
  Get host MAC via REST API inside container bschandra 4 3,642 November-16th-2020, 09:26 AM
Last Post: bschandra

Forum Jump:


Users browsing this thread: 1 Guest(s)