title: What is the equivalent of current_kernel_time in Linux kernel v5?
body: <p>I tried to compile some kernel modules from Pleora eBUS SDK on a Linux Ubuntu 19.04 machine with Kernel version 5.0.0-38-generic, but got the compilation error:</p>
  
  <pre><code>error: implicit declaration of function ‘current_kernel_time’; did you mean ‘core_kernel_text’? [-Werror=implicit-function-declaration]
    lTime = current_kernel_time();
  </code></pre>
  
  <p>and another (same issue) for function <code>do_gettimeofday</code>.</p>
  
  <p>I noticed that <code>current_kernel_time</code> and <code>current_kernel_time64</code> were still available in kernel v4.15 (used by my other machine with Ubuntu 18.04 for example), last seen in <a href="https://elixir.bootlin.com/linux/v4.19.97/source/include/linux/timekeeping32.h#L23" rel="nofollow noreferrer">linux v4.19.97</a>. In <a href="https://elixir.bootlin.com/linux/v5.0/source/include/linux/time.h" rel="nofollow noreferrer">time.h</a> header of my kernel version there is a function <code>get_timespec64</code> which seems to do something similar, however it accepts 2 arguments and it doesn't seem correct to me (because in the sources I saw that there is a <code>copy_from_user</code> invoked) to pass some uninitialized <code>const struct __kernel_timespec __user *uts</code> as a second argument. Can someone give me some hint how to replace calls to <code>current_kernel_time</code> in my newer kernel version?</p>
  
  <p>Example code that needs to be modified:</p>
  
  <pre><code>OS_UINT64 OS_TimeGetUS( OS_VOID )
  {
      struct timespec64 lTime;
      lTime = current_kernel_time();
      return ( lTime.tv_sec * 1000000 + OS_DIV64( lTime.tv_nsec, 1000 ) );
  }
  </code></pre>