i'm a beginner of linux. (sorry about my poor english) I should print current time and do something through system call in linux. I did other things but failed to print current time.. I wrote like
#include<linux/kernel.h>
#include<linux/time.h>
...
asmlinkage long sys_printtime(void) {
...
struct timeval time;
struct tm tm1;
...
do_gettimeofday(&time);
local_time=(u32)(time.tv_sec -(sys_tz.tz_minuteswest * 60));
time_to_tm(local_time,(3600*9),&tm1);
printk(KERN_DEBUG "time @(%04d-%02d-%02d %02d:%02d:%02d)\n", tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour,tm1.tm_min,tm1.tm_sec);
...
return 0;
}
but it doesn't work.
The error said i can not use do_gettimeofday, and i finally knew that i can not use do_gettimeofday anymore because kernel5 doesn't support. I searched on google and stackoverflow, but i don't know how to print current time in kernel5.. anybody can help me?