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. Can i trust the result of clock_getres?

Can i trust the result of clock_getres?

Scheduled Pinned Locked Moved C / C++ / MFC
performancequestionannouncement
3 Posts 3 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.
  • E Offline
    E Offline
    elelont2
    wrote on last edited by
    #1

    Hi, i am confused about the return value of the clock_getres functions. I am running on custom hw with armv4 cpu and kernel version 2.6.26. I get values 7812500 (nanoseconds) for CLOCK_REALTIME and CLOCK_MONOTONIC. Can i trust that the resolution of gettimeofday (uses CLOCK_REALTIME?) calls is ~7.8ms? Does the CPU clock speed affect this value? Regards ele lont

    S C 2 Replies Last reply
    0
    • E elelont2

      Hi, i am confused about the return value of the clock_getres functions. I am running on custom hw with armv4 cpu and kernel version 2.6.26. I get values 7812500 (nanoseconds) for CLOCK_REALTIME and CLOCK_MONOTONIC. Can i trust that the resolution of gettimeofday (uses CLOCK_REALTIME?) calls is ~7.8ms? Does the CPU clock speed affect this value? Regards ele lont

      S Offline
      S Offline
      Stefan_Lang
      wrote on last edited by
      #2

      Most time functions have a resolution that is about on this order of magnitude. I've read somewhere that on most current systems the resolution is about 10-20ms, but 7.8ms sounds entirely reasonable too. And no, CPU speed doesn't matter. Note that there are also functions for high-res time measurement. There is plenty of info about it on the web

      GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

      1 Reply Last reply
      0
      • E elelont2

        Hi, i am confused about the return value of the clock_getres functions. I am running on custom hw with armv4 cpu and kernel version 2.6.26. I get values 7812500 (nanoseconds) for CLOCK_REALTIME and CLOCK_MONOTONIC. Can i trust that the resolution of gettimeofday (uses CLOCK_REALTIME?) calls is ~7.8ms? Does the CPU clock speed affect this value? Regards ele lont

        C Offline
        C Offline
        CPallini
        wrote on last edited by
        #3

        You should. However you could also make a test.

        THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite

        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