驅動程式 - Linux Device Driver(LDD) - 如何列印時間



void print_time(void)
{
    struct timeval t;
    struct tm broken;

    do_gettimeofday(&t);
    time_to_tm(t.tv_sec, 0, &broken);
    printk("%d:%d:%d:%ld\n", broken.tm_hour, broken.tm_min, broken.tm_sec, t.tv_usec);
}