I've made a programmable power switch using Raspberry Pi (although this question is not RPi specific - it's more of "generic Linux" with problem caused by hardware shortcomings.) Raspberry has no battery-backed RTC; it's intended to work networked and sync its clock soon after boot-up over network.
My problem is, that while I do programming of said switch over the net, and I can get given sockets to switch on/off at given hour that way, the device itself is to be used at different locations, including non-networked ones. When if I carry it from where I programmed it to where it's to be plugged in, it's unpowered and the clock loses state. After I power it back up, it has no connectivity to restore the date.
The few minutes when it's unpowered is not a problem for me - I don't mind the clock being off by a minute or two. I mind if it's off by 43 years as is the case after I switch it on non-networked.
Is there some neat way to restore the clock on boot-up to a state from before the system went down due to power loss? (writing it every second to SD card which is the memory medium of RPi will kill the card quite fast so that's not quite an option.)