Reliable timekeeping for intermittent computing