Time.h only tracks time when connected through serial port

I have been trying to get the Time library to set time through a message via serial, but it only starts tracking time when the serial port is opened and stops when I disconnect. I need to be able to set the time via serial com and then disconnect without the time resetting. I have been using the provided sketches with the Timer and TimerAlarms library.

Thanks for any help.

Do you know what is an RTC? I think you need one!

It is looking like I will be needing to get one. I was hoping I wouldn't need it, but I guess having a battery back up clock will be a plus.

I have been using an arduino and Ethernet shield to get time from the internet for over a year it polls the served every 24 hrs and I never have a problem keeping time with it and with NO RTC. It has to be something to do with the code that you are using to set it there will be something like a while serial available somewhere that may b your problem.