Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3997714
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:26:08+00:00 2026-05-20T07:26:08+00:00

If I get the time using clock_gettime(CLOCK_MONOTONIC,x), then call yield (e.g. sched_yield()), then get

  • 0

If I get the time using clock_gettime(CLOCK_MONOTONIC,x), then call yield (e.g. sched_yield()), then get the CLOCK_MONOTONIC time again, will the difference in times include the time the program wasn’t running (having yielded), or does CLOCK_MONOTONIC only track the time during which the program is executing? My tests seem to imply the latter, but I’d like to know for sure.

Also, if CLOCK_MONOTONIC doesn’t include the time yielded, is there another monotonic timer (ie. one not subject to jumps caused by ntp) that does?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:26:09+00:00Added an answer on May 20, 2026 at 7:26 am

    The answer Maxim and comments to that answered the second part of your question, I believe. To expand on the answer for the first part, POSIX 2008 states


    If the Monotonic Clock option is supported, all implementations shall support a clock_id of CLOCK_MONOTONIC defined in <time.h>. This clock represents the monotonic clock for the system. For this clock, the value returned by clock_gettime() represents the amount of time (in seconds and nanoseconds) since an unspecified point in the past (for example, system start-up time, or the Epoch). This point does not change after system start-up time.

    In particular, note “the monotonic clock for the system”. That is, per-system and not per-process, it keeps ticking even though your process is not running. Also, “This point does not change after system start-up time.”, which again implies that it keeps ticking regardless of whether a particular process is running or sleeping.

    So, either you have found a bug in the Linux implementation, or more likely, in your test program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problem using the clock_gettime() function. #include <iostream> #include <time.h> timespec timer_start;
Folks, in my application I'm using clock_gettime(CLOCK_MONOTONIC) in order to measure the delta time
I'm looking for solution to get time to click on element using implicitlyWait in
This is my first time using Google Analytics Ecommerce Tracking to get data for
This is my first time using jQuery and I am pleased to get my
Creating a simple RPG game, first time using XNA. Trying to get my character
I am using the following method to get the time of the video with
I am using boost::format variable to get elapsed time in seconds boost::posix_time::time_duration total_time =
How to get current time of different countries in C# by using following any
How can we get exact time to load a page using Selenium WebDriver? We

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.