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