Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-05-2010, 04:21 PM   #1
LQ Newbie
Registered: Jul 2010
Posts: 4

Rep: Reputation: Disabled
Question Is CLOCK_MONOTONIC_RAW implemented in Red Hat 7.2?


I tried defining CLOCK_MONOTONIC_RAW in the include file. The timer does not run correctly.

I am looking for a timer that I can count on to get a time delta.

In my /usr/include/bits/time.h I have CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID defined. I assume they are not based on the realtime clock (not changed when time is updated.

All I really need is a way to determine delta time when running. mili-seconds would be great, 1/100th second is preferred, and 1/10th would be acceptable.

___( Original Post )___________________
"A tick, a tick, my kingdom for a tick."

Please have patience and read on. This is a rather convoluted situation.

The company currently does (since 1994) a loop cycle based task execution process. They tasked me to run a particular task at a particular interval. This is where I found the loop process and how much time delta time there can be.

I want to implement a time based version. Nothing really drastic, just call the task when the timer says so. I know how I want to do it, they just keep throwing roadblocks in the way.

The latest one is "what if someone changes the time ?". I looked on the web and my research seems to indicate that if I use clock_gettime(CLOCK_REALTIME,&ts) that indeed delta time can be messed up if something tinkers with the time.

The other option is to use CLOCK_MONOTONIC_RAW instead of CLOCK_REALTIME. It is indicated that this can not be changed and would be good for this type of application. The problem is I don't know if it is implemented in the version the company distributes, Red Hat Linux Release 7.2 (Enigma). Anyone know anything about this?

Again, the company distributes it's product that runs on Red Hat 7.2. They have many units in the field. I read on the web that 1) There is no tick and 2) Red Hat 6 has the CLOCK_MONOTONIC_RAW implemented. Well, I looked at /usr/include/bits/time.h and found CLOCK_REALTIME but not CLOCK_MONOTONIC_RAW.

I then looked on the web again and found someone stating that CLOCK_MONOTONIC_RAW was implemented in Red Hat 6, but the #define for it was not. They stated that they just added the #define to /usr/include/bits/time.h . I certainly do not trust this, but would ask if this is indeed the case.

I understand that there is a patch to implement this, but being a newbie, I do not know how hard it would be and if it could be done as part of loading a new version of the companies application. Can anyone talk some on that (If this is the way I would need to go)?

Sorry to run on, but I wanted to cover the bases of the situation at hand. Thank you for reading this through even if you do not respond.

___(Found I was not including the correct library for time functions___)

Last edited by leonm54; 08-09-2010 at 08:54 AM. Reason: New tests and code inspection modified query
Old 08-11-2010, 09:24 AM   #2
LQ Newbie
Registered: Jul 2010
Posts: 4

Original Poster
Rep: Reputation: Disabled
Question Reliable clocks for "tick" impelmentation?

Does anyone know if CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID are reliable? I haven't found a good comparison between them and CLOCK_MONOTONIC_RAW.

Anyone know the steps it would take to update the OS to be able to utilize CLOCK_MONOTONIC_RAW? Again, the company uses Red Hat 7.2. Yes, I know it is old, but it is what I need to support.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Red Hat Summit 2007, Day 2: Red Hat Exchange and interesting presentations LXer Syndicated Linux News 0 05-11-2007 07:32 PM
LXer: Red Hat to launch Red Hat Enterprise Linux 5 before March LXer Syndicated Linux News 0 12-30-2006 08:03 AM
LXer: Red Hat Announces First Red Hat Developer Day In India LXer Syndicated Linux News 0 10-27-2006 07:54 PM
Red Hat does not plan to release another product in the red hat linux line... Whitehat General 5 11-03-2003 06:33 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:39 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration