Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. TIme checking in C++ for visual 6

TIme checking in C++ for visual 6

Scheduled Pinned Locked Moved C / C++ / MFC
c++
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nahitan
    wrote on last edited by
    #1

    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,

    M M 2 Replies Last reply
    0
    • N nahitan

      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,

      M Offline
      M Offline
      Maxwell Chen
      wrote on last edited by
      #2

      In the logger, use a counter to count, and check if the day-value changes.

      Maxwell Chen

      1 Reply Last reply
      0
      • N nahitan

        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,

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        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:

        N M 2 Replies Last reply
        0
        • M Mark Salsbery

          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:

          N Offline
          N Offline
          nahitan
          wrote on last edited by
          #4

          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,

          M 1 Reply Last reply
          0
          • N nahitan

            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,

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            Mark Salsbery wrote:

            ...use GetLocalTime() or GetSystemTime()...

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            L 1 Reply Last reply
            0
            • M Mark Salsbery

              Mark Salsbery wrote:

              ...use GetLocalTime() or GetSystemTime()...

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #6

              You can lead a horse to water but you can't make him fish ;P

              led mike

              1 Reply Last reply
              0
              • M Mark Salsbery

                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:

                M Offline
                M Offline
                Maxwell Chen
                wrote on last edited by
                #7

                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 at 00: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

                M 1 Reply Last reply
                0
                • M 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 at 00: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

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #8

                  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:

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups