全部博文(140)
分类: C/C++
2014-03-05 10:05:18
yandongxiao2014-03-06 19:15:17
内核态下,获取当前时间的方法:
struct rtc_time result;
struct timeval time;
do_gettimeofday(&time)
skb->tstamp = timeval_to_ktime(time)
rtc_time_to_tm(time.tv_sec, &result);
printk("%d-%d-%d %d:%d:%d\n", result.tm_year+1900, result.tm_mon+1, result.tm_day, result.tm_hour, result.tm_min, result.tm_sec )