R
roughtrader
Hello,
I have a function that retrieves the epoch time from a remote server.
Let's say it's: time_t retrieveTime();
I have an MFC application, and I want to continually update a time_t
variable using the function retrieveTime(), in order to build a clock
with 1-second resolution from the remote server.
I can't use a while loop because the enclosing function would never
release control of the application, and that would defeat the point of
having an application.
What I *think* should be done is to create a timer that starts
counting once the application is launched. The resolution on the
timer could be as fast as 1 millisecond. Each time the timer updates,
retrieveTime() could be called and the value stored in a variable.
Basically, I want to build this clock and keep it "out of the way" of
the main application. Am I on the right track here? Can someone
suggest some code that would help get me started?
thanks,
rt
I have a function that retrieves the epoch time from a remote server.
Let's say it's: time_t retrieveTime();
I have an MFC application, and I want to continually update a time_t
variable using the function retrieveTime(), in order to build a clock
with 1-second resolution from the remote server.
I can't use a while loop because the enclosing function would never
release control of the application, and that would defeat the point of
having an application.
What I *think* should be done is to create a timer that starts
counting once the application is launched. The resolution on the
timer could be as fast as 1 millisecond. Each time the timer updates,
retrieveTime() could be called and the value stored in a variable.
Basically, I want to build this clock and keep it "out of the way" of
the main application. Am I on the right track here? Can someone
suggest some code that would help get me started?
thanks,
rt