I want to write a program to run a countdown timer with initial start value of, say, 7 years. The computer can reboot in between. I can think of file based approach:
open file
if file_empty write initval = 7 years
while cpu_on
write timestamp to file
sleep for 1 sec
However, how can I find the time elapsed between reboots? Accuracy within 1 sec is fine for me. Assume code is for a stand-alone system, say, a space-craft which hibernates for long time period without permanent network connectivity.