[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

code for retrieving system time in a device driver



Hi All,

i have been trying to modify a device driver. I want to write a code
to retrieve the system date and time. My code runs fine as a normal c
program but it does not even compile when I insert the same in a
device driver.
Can you tell me whats wrong?

Here is the segment of code:
	struct			timeval*  tv;
	struct			timezone* tz;
	struct tm		*timeVar; 

	do_gettimeofday(tv);
	timeVar = localtime((time_t*)&tv.tv_sec);
There is a compile time error in localtime function. it says
assignment makes pointer from integer without a cast. But I guess i am
doing alright.

Let me know anyone found out what wrong i am doing.

thanks,
Samar



Reply to: