Hi, everybody. I have a problem when get time from linux kernel. I writing a driver module on CentOS 5.4, kernel 2.6.18. I want to read day, month, year, hour, minute, second of system, then would printk to screen monitor. Now, i had read hour, minute, second of system folow this code:
get_time = tv.tv_sec;
sec = get_time % 60;
tmp1 = get_time / 60;
min = tmp1 % 60;
tmp2 = tmp1 / 60;
hr = tmp2 % 24;
hr = hr + 7; /* convert to GMT+7 */
po_data.opcode = 0x55;
po_data.cmd = 0x01;
po_data.reverse = 0x00;
po_data.data = (unsigned char)hr;
po_data.data = (unsigned char)min;
printk(KERN_ALERT "%d:%d \n",hr,min);
But, i don't get day, month, year of system. I use the command
tmp = getdate(0);
(KERN_ALERT "%d-%d \n",tmp->tm_mon,tmp->tm_mday);
and get error: error: implicit declaration of function getdate. I had include time.h or sys/time.h but get error: sys/time.h: No such file or directory.
How to get day, month and year from driver ? Can it ? if not, why ?
thanks and regards.