TIme checking in C++ for visual 6
-
Hi there, I have an application that sends/ receives messages via sockets and logs all the messages for future inquiry. I need to check a particular message and count the number of message I received every day. SO I need a timer that resets everyday (say 00:00:00) and restart the timer. I appreciate any ideas Thanks,
-
Hi there, I have an application that sends/ receives messages via sockets and logs all the messages for future inquiry. I need to check a particular message and count the number of message I received every day. SO I need a timer that resets everyday (say 00:00:00) and restart the timer. I appreciate any ideas Thanks,
In the logger, use a counter to count, and check if the day-value changes.
Maxwell Chen
-
Hi there, I have an application that sends/ receives messages via sockets and logs all the messages for future inquiry. I need to check a particular message and count the number of message I received every day. SO I need a timer that resets everyday (say 00:00:00) and restart the timer. I appreciate any ideas Thanks,
Maybe use SetTimer() to create a periodic timer, set to an interval appropriate for the accuracy you desire. On each WM_TIMER message, use GetLocalTime() or GetSystemTime() to check for the wall clock time you want to do the reset at. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Maybe use SetTimer() to create a periodic timer, set to an interval appropriate for the accuracy you desire. On each WM_TIMER message, use GetLocalTime() or GetSystemTime() to check for the wall clock time you want to do the reset at. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Thanks for the tip, but as I am new in this area, I am not sure how to check for the time in my application. like if time (00:00:00 set counter to zero)... Regards,
Mark Salsbery wrote:
...use GetLocalTime() or GetSystemTime()...
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Mark Salsbery wrote:
...use GetLocalTime() or GetSystemTime()...
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Maybe use SetTimer() to create a periodic timer, set to an interval appropriate for the accuracy you desire. On each WM_TIMER message, use GetLocalTime() or GetSystemTime() to check for the wall clock time you want to do the reset at. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Mark Salsbery wrote:
SetTimer() to create a periodic timer, set to an interval appropriate for the accuracy you desire.
There would be the first thing to do for
SetTimer
solution: To precisely seed the timer right at the point at00:00:00
(as in the OP mentioned). It takes effort. Then another thing to concern: When the user or NTP service adjust the time (let's say 5 minutes fast, originally 19:28:02 --> new time 19:33:02), the next timeout event will be fired at 00:05:00, not the original configuration 00:00:00.Maxwell Chen
-
Mark Salsbery wrote:
SetTimer() to create a periodic timer, set to an interval appropriate for the accuracy you desire.
There would be the first thing to do for
SetTimer
solution: To precisely seed the timer right at the point at00:00:00
(as in the OP mentioned). It takes effort. Then another thing to concern: When the user or NTP service adjust the time (let's say 5 minutes fast, originally 19:28:02 --> new time 19:33:02), the next timeout event will be fired at 00:05:00, not the original configuration 00:00:00.Maxwell Chen
Of course...It really didn't sound like it needed that kind of accuracy. Checking once a minute for 00:00 might be sufficient. Or check every second and catch the first midnight rollover. Or it could sit in a busy loop monitoring the atomic clock in Colorado. I just threw the option out there :) Cheers, Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: