title: How to get current hour (time of day) in linux kernel space
body: <p>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 bed early. (I know I could also use any number of different techniques including cron etc, but I wanted to learn kernel programming...)</p>
  
  <p>As a first version, I therefore check if the current hour is between start and end, which are set via parameters to the module.</p>
  
  <p>My question is therefore : How do I get the current hour? I have no access to the usual time functions in the standard library because I am in kernel space. I'm guessing that I should be using do_gettimeofday() for this, but that only gives me seconds and nanoseconds, and I need hours in the current day.</p>
  
  <p>Thanks.</p>