Regarding settimeofday

vijaynikam - June 29, 2009

Dear All, I have Linux kernel 2.6.23 with HRT enable on mpc83313erdb. I have wrote a simple program to test and evaluate settimeofday() function as follows; (just the required code snippet) #include <sys/time.h> #include <time.h> struct timeval ts; ts.tv_sec = 31113133; // Some value ts.tv_usec = 267930040; // some value; ret = settimeofday(&ts, NULL); if(ret) perror("settimeofday"); the compilation is ok but when I load it on target and run the program it says "settimeofday: Invalid argument" I checked in man pages and they said that u should pass tz (timezone) as NULL as it obsolete. I do not what else I am missing ? ? ? Could anyone please let me know what I am doing wrong or missing here ? ? ? Kindly please acknowledge ... thank you. Kind Regards, Vijay Nikam
Share this

Comments

Regarding settimeofday

I would guess that tv_usec should be between 0 and 999,999. Jim

Regarding settimeofday

Yes ... your guess is right ... Actually when I read the value using gettimeofday() ... I noticed the value of usec parameter. Thanks. Kind Regrds, Vijay Nikam