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 6039287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:20:46+00:00 2026-05-23T06:20:46+00:00

According to Android Developer Reference uptimeMillis() returns the number of milliseconds since boot, not

  • 0

According to Android Developer Reference uptimeMillis() returns the number of milliseconds since boot, not counting time spent in deep sleep. I checked the implementation of
uptimeMillis() in my code and it is roughly like this-

struct timespec t;
t.tv_sec = t.tv_nsec = 0;
clock_gettime(CLOCK_MONOTONIC, &t);
return (int64_t)(t.tv_sec)*1000000000LL + t.tv_nsec;

As far as I know CLOCK_MONOTONIC counts from some unspecified point linearly including sleep time.

Here are my doubts-

  1. If CLOCK_MONOTONIC includes sleep time, how come uptimeMillis() doesn’t take it into account? If my understanding is wrong and CLOCK_MONOTONIC doesn’t take sleep into account, then what should I use to get system uptime including sleep?

  2. What is deep sleep? Is the CPU idling referred as deep sleep?

  3. What is the value of unspecified point in Linux? Can you kindly point out in code where this clock is started?

  • 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-23T06:20:47+00:00Added an answer on May 23, 2026 at 6:20 am
    1. CLOCK_MONOTONIC stops when the system is suspended. Some people felt this was a mistake, and subsequently there have been patches for adding a CLOCK_BOOTTIME clock: https://lwn.net/Articles/428176/ . I don’t know if these patches have yet been included in the mainline kernel. CLOCK_BOOTTIME is in ndk-9c – it only took 2,5 years 😉 – Wojciech

    2. Suspend, I guess.

    3. IIRC some fixed time before boot. You’ll find the exact value if you dig into the kernel source. Then again, the entire point about it being unspecified is that it could change at any point, so relying on it seems unwise to me.

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

Sidebar

Related Questions

According to: http://developer.android.com/sdk/android-2.0-highlights.html Android 2.0 should support the HTML5 video element. I haven't been
According to http://developer.android.com/guide/practices/screens_support.html Normal screen with hdpi can have few resolutions, like 480X800 600x1024
According to android icon design guidelines ( here , see table #1), developer needs
I've made a customer status bar notification according to the Android Developer's Guide. I
According to developer.android.com, the Android supports the playing of video using the H.263, H.264
According to http://developer.android.com/guide/market/billing/billing_admin.html#billing-list-setup To create a product list for an application, follow these steps:
I just set up eclipse to start android development according to this http://developer.android.com/sdk/installing.html .
I've created a WebView-based application according to http://developer.android.com/resources/tutorials/views/hello-webview.html Although I did exactly what was
I have a question which is not really related to android. but because i'm
I am trying to Build a gallery in Android ( Not exactly what is

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.