'struct timeval last' is used for recording last time interrupt.
'struct timeval now' is used for calculating elapsed time.
32-bit systems using 'struct timeval' will break in the year 2038,
so we have to replace that code with more appropriate types.
This patch changes the comedi driver to use ktime_t.
Since this code doesn't communicate the time values
to the outside (user space, file system, network).Thus ktime_get()
is a better than using do_gettimeofday() as it uses monotonic
clock.
ktime_to_us() returns an 's64', and using the '%' operator on that requires
doing a 64-bit division which needs an expensive library function call
the specific value of usec_current does not actually matter although it might
matter that it's not always the same
which will start with the offset from the lower 32 bit of the microsecond.
Therefore:
devpriv->usec_current = (ktime_to_us(devpriv->last) % USEC_PER_SEC)
% devpriv->usec_period;
is replaced by