ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi i want to use a high resolution clock to support my realtime app.
I was using gettimeofday() b4, but now i want to sync time at some machines and now this timebase is no longer a stable one.
So i tried to use not CLOCK_REALTIME and found CLOCK_MONOTONIC.
Had to link librt to my app, compiles fine but :
If i call clock_gettime with clockid CLOCK_MONOTONIC on my target machine, i got a retval of -1, meaning this is not supported by the system.
Running my app with the same kernel on my developing machine, this works quite fine but on the target system (a cyrix C3-2) it just returns -1 !!
Can somebody explain me, why on my cyrix machine it does not work and on a plain P4 desktop it does (with the same (self-compiled) kernel)? Can it be a problem with glibc or really with the hardware ?
I also found out, that on the cyrix, the clock_getres for REALTIME gaves me about 10ms and on the P4 it says about 1ms .....
Does someone know other methods to get a monothonic clock with at least 1ms res ?
Btw, i'm using kernel 2.6.16-16
Greetings
Robert
Last edited by nathan2225; 07-18-2006 at 10:26 AM.
Somehow all the slackware packages (i'm using slackware tgz packages) were compiled with emulated timers, not using the timers offered by the OS.
I tried a debian compiled glibc package and it suddenly worked, hurray !!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.