How to get current hour (time of day) in linux kernel space

前端 未结 5 710
我在风中等你
我在风中等你 2020-12-14 08:14

I\'m writing a kernel module that checks to see if the time is between two specified hours, and disables input if it is. This has to do with me wanting to make sure I go to

5条回答
  •  温柔的废话
    2020-12-14 08:45

    We can use clock_gettime function with CLOCK_REALTIME as the type of clock.

    Reference http://linux.die.net/man/3/clock_gettime

    Just doing a strace on date executable gives us an idea to get the current date in the kernel mode.

提交回复
热议问题