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. function time

function time

Scheduled Pinned Locked Moved C / C++ / MFC
linuxhelpquestion
10 Posts 6 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.
  • A Offline
    A Offline
    afpr
    wrote on last edited by
    #1

    I need a function to get time(seconds and microseconds) in windows, like gettimeofday in Linux. Can you help me? Thanks

    L T 2 Replies Last reply
    0
    • A afpr

      I need a function to get time(seconds and microseconds) in windows, like gettimeofday in Linux. Can you help me? Thanks

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

      GetSystemTime()

      led mike

      A J 2 Replies Last reply
      0
      • L led mike

        GetSystemTime()

        led mike

        A Offline
        A Offline
        afpr
        wrote on last edited by
        #3

        I need to get the microseconds too. What is the function, if exists? thanks

        L D 2 Replies Last reply
        0
        • A afpr

          I need to get the microseconds too. What is the function, if exists? thanks

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

          Opps sorry, I saw milliseconds. I don't know if microseconds are supported.

          led mike

          1 Reply Last reply
          0
          • A afpr

            I need to get the microseconds too. What is the function, if exists? thanks

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            afpr wrote:

            I need to get the microseconds too. What is the function, if exists?

            Windows does not have that level of resolution. What exactly are you trying to do?


            "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

            "Judge not by the eye but by the heart." - Native American Proverb

            A 1 Reply Last reply
            0
            • D David Crow

              afpr wrote:

              I need to get the microseconds too. What is the function, if exists?

              Windows does not have that level of resolution. What exactly are you trying to do?


              "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

              "Judge not by the eye but by the heart." - Native American Proverb

              A Offline
              A Offline
              afpr
              wrote on last edited by
              #6

              I'm trying to calculate time between send and receive a packet. I'm using packet.dll. thanks

              J 1 Reply Last reply
              0
              • A afpr

                I'm trying to calculate time between send and receive a packet. I'm using packet.dll. thanks

                J Offline
                J Offline
                John M Drescher
                wrote on last edited by
                #7

                You might want to look at this http://www.codeproject.com/datetime/perftimer.asp[^] and this http://www.codeproject.com/datetime/ccputicker.asp[^]

                John

                1 Reply Last reply
                0
                • L led mike

                  GetSystemTime()

                  led mike

                  J Offline
                  J Offline
                  Julberto Danray
                  wrote on last edited by
                  #8

                  Check ::GetSystemTimeAsFileTime() in the MSDN library.

                  1 Reply Last reply
                  0
                  • A afpr

                    I need a function to get time(seconds and microseconds) in windows, like gettimeofday in Linux. Can you help me? Thanks

                    T Offline
                    T Offline
                    ThatsAlok
                    wrote on last edited by
                    #9

                    afpr wrote:

                    I need a function to get time(seconds and microseconds) in windows, like gettimeofday in Linux.

                    try Multimedia timers .. timeGetDevCaps api will starting api for same

                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                    cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

                    A 1 Reply Last reply
                    0
                    • T ThatsAlok

                      afpr wrote:

                      I need a function to get time(seconds and microseconds) in windows, like gettimeofday in Linux.

                      try Multimedia timers .. timeGetDevCaps api will starting api for same

                      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                      cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

                      A Offline
                      A Offline
                      afpr
                      wrote on last edited by
                      #10

                      I have found a solution. Use this functions: /* Initialize everything to 0 */ void sec_init(void) { LARGE_INTEGER lFreq, lCnt; QueryPerformanceFrequency(&lFreq); freq = (double)lFreq.LowPart; QueryPerformanceCounter(&lCnt); start = lCnt.LowPart; } /* return number of seconds since sec_init was called with ** a gross amount of detail */ double sec(void) { LARGE_INTEGER lCnt; long tcnt; QueryPerformanceCounter(&lCnt); tcnt = lCnt.LowPart - start; return ((double)tcnt) / freq; }

                      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