SliTaz SliTaz Forum

You are not logged in.

#1 2024-01-14 16:06:16

gibor
Moderator
Registered: 2011-04-30
Posts: 1,067

Question about hwclock

Domanda su hwclock

Salve a tutti, ho un sistema che non prevede il mantenimento dell'ora ad apparecchio spento. Alcune distribuzioni sembra effettuino un salvataggio in locale dell'ora ricevuta da ntpd, ricaricandola al riavvio successivo se il server non è disponibile. In pratica il sistema congela l'ultima data e ora ricevuta (fra questi pure windows esegue la stessa operazione). Lasciando disalimentato il pc all'infinito, sembra (dico sembra soltanto) non perdere mai la memoria. In sostanza basta uno script che salva l'ultima data e ora in un file, ed al riavvio la reimposta nel sistema.

Questo su slitaz non sembra avvenire... qualche idea di come implementare uno script su rc.shutdown ed il relativo ripristino rcS di avvio.

È solo un'idea, ma magari può servire anche ad altri sui sistemi embedded privi di batteria tampone

-----------------------------------------------------------------------------------------------------------------------

.Question about hwclock

Hi all, I have a system that does not provide time keeping when the device is turned off. Some distributions seem to do a local save of the time received from ntpd, reloading it on next reboot if the server is unavailable. In practice, the system freezes the last date and time received (among them windows also performs the same operation). Leaving the pc unpowered indefinitely, it seems (I only say seems) to never lose the memory. Basically all it takes is a script that saves the last date and time in a file, and on reboot restore it in the system.

This on slitaz doesn't seem to happen...any idea how to implement a script on rc.shutdown and the associated rcS boot restore.

Just an idea, but maybe it may be of use to others on embedded systems without battery back-up

Offline

#2 2024-01-15 13:08:20

gibor
Moderator
Registered: 2011-04-30
Posts: 1,067

Re: Question about hwclock

Not elegant, but functional. simple addition in /etc/init.d/rc.shutdown and /etc/initd/local.sh

date '+%Y%m%d %H:%M:%S' > /var/lib/hwclock/date

date=[c]cat /var/lib/hwclock/date[/c]

date --set="$date"

Offline

#3 2024-01-15 16:46:46

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Re: Question about hwclock

Hi Gibor,

After search about time without RTC, found fake-hwclock.

Similar to your stuff.

https://git.einval.com/cgi-bin/gitweb.cgi?p=fake-hwclock.git;a=summary

Let's me check to pack them smile

Offline

#4 2024-01-15 18:13:17

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Re: Question about hwclock

Built in and put on my space :

https://people.slitaz.org/~shann/fake-hwclock/fake-hwclock-0.13.tazpkg

Post install save time to /etc/fake-hwclock.data.

[c]/etc/init.d/fake-hwclock start[/c] to restore time

[c]/etc/init.d/fake-hwclock stop[/c] to save time

With this, can be put as daemon on /etc/rcS.conf, at boot restore time and shutdown save it.

Offline

#5 2024-01-16 06:33:03

gibor
Moderator
Registered: 2011-04-30
Posts: 1,067

Re: Question about hwclock

Ottimo, Soluzione perfetta. Grazie mille!

Excellent, perfect solution. Thank you very much!

Offline

#6 2024-01-17 18:36:37

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Re: Question about hwclock

Hi gibor,

I put in in cooking, it's now on repo smile

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.021 seconds, 7 queries executed - Memory usage: 1.55 MiB (Peak: 1.77 MiB) ]