[rx51] real time clock problems
Created by: pavelmachek
As soon as you remove battery, RTC loses time. Unfortunately, I remove batteries all the time during development. Wrong time and/or time going backwards does bad stuff to unix system: git clone fails to work due to expired certificates, make fails to rebuild binaries, etc.
I re-built pmOS image, and system booted with date in 1970, even through /etc/passwd had todays date. We can do better.
I'm using this:
#!/bin/bash F=/etc/zaurus.time if [ $(date +%s) -lt $(< F) ]; then date -s @(< $F) fi date +%s > $F
..runing it during boot and during shutdown. That way, I get approximately right time, good enough for https and make. I see bash might be an issue; if needed, I can rewrite it in sh, C or Python. Would something like this be acceptable?