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

  • Home
  • SEARCH
  • 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 3724648
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T06:43:00+00:00 2026-05-19T06:43:00+00:00

Jiffies counter returns an unsigned integer of size four bytes. when the counter reaches

  • 0

Jiffies counter returns an unsigned integer of size four bytes. when the counter reaches maximum value then it restarts from 0 again. I’ll subtract the latest value with the old value to get the duration. So how should i consider for a case such that when the old value is of maximum value and new value is more than zero so that I’ll get wrong duration?

  • 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-19T06:43:01+00:00Added an answer on May 19, 2026 at 6:43 am

    You don’t have to do anything, you’ll have the correct duration (as long as you make all your calculations using four bytes unsigned integers). That’s the magic of integer values implemented as fixed-width binary arithmetic.

    Here is an example with 8 bits unsigned integers. You can actually see that even when there’s overflow, the difference is still valid.

    236 - 221 = 11101100 - 11011101 = 11101100 + 00100011 = 00001111 = 15
    251 - 236 = 11111011 - 11101100 = 11111011 + 00010100 = 00001111 = 15
     10 - 251 = 00001010 - 11111011 = 00001010 + 00000101 = 00001111 = 15
     25 -  10 = 00011001 - 00001010 = 00011001 + 11110110 = 00001111 = 15
       ...
    

    Your single problem comes when the duration is not small compared to the maximum value of the counter, i.e. when it can be larger than the half of the maximum value.

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

Sidebar

Related Questions

How do I manually convert jiffies to milliseconds and vice versa in Linux? I
I've read chapter 7 in the 'Linux Device Drivers' (which can be found here)
I am trying to count the total number of clock ticks for each process
So I'm trying to write a kernel module that uses the linux/timer.h file. I
I'm working on linux and am using the values in /proc//stat to log performance

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.