I'm confused. Your one reply seemed to indicate you'd use a real time clock, and then you say not real time. Wanna go for two out of three?
Anyhoo, this is pretty straightforward, have you given it a try yourself? Might be an educational experience you know.