• Tina Ruchandani's avatar
    ALSA: es1968: Replace timeval with ktime_t · eafe8404
    Tina Ruchandani authored
    es1968_measure_clock uses struct timeval, which on 32-bit systems will overflow
    in 2038, leading to incorrect interpretation of time.This patch changes the
    function to use ktime_t instead of struct timeval, which implies:
    - no y2038: ktime_t uses a 64-bit datatype explicitly.
    - efficent subtraction: The earlier version computes the difference in usecs
      while dealing with secs and nsecs. It requires checks to see if the nsecs of
      stop is less than start. This patch uses a direct subtract of ktime_t and
      converts to usecs.
    - use of monotonic clock (ktime_get) over real time (do_gettimeofday),
      which simplifies timekeeping, as it does not have to deal with cases
      where stop_time is less than start_time.
    Signed-off-by: default avatarTina Ruchandani <ruchandani.tina@gmail.com>
    Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    eafe8404
es1968.c 79.1 KB