Ignore:
Timestamp:
Jan 4, 2021, 10:15:17 AM (5 years ago)
Author:
Paul Smedley
Message:

Update source to linux 5.10.4 level

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/lib32/timer.c

    r615 r629  
    174174//******************************************************************************
    175175
     176/**
     177 * ns_to_timespec - Convert nanoseconds to timespec
     178 * @nsec:       the nanoseconds value to be converted
     179 *
     180 * Returns the timespec representation of the nsec parameter.
     181 */
     182struct timespec64 ns_to_timespec64(const s64 nsec)
     183{
     184        struct timespec64 ts;
     185        s32 rem;
     186
     187        if (!nsec) {
     188                ts.tv_sec = 0;
     189                ts.tv_nsec = 0;
     190                return ts;
     191        }
     192
     193        ts.tv_sec = div_s64_rem(nsec, NSEC_PER_SEC, &rem);
     194        if (unlikely(rem < 0)) {
     195                ts.tv_sec--;
     196                rem += NSEC_PER_SEC;
     197        }
     198        ts.tv_nsec = rem;
     199
     200        return ts;
     201}
     202//******************************************************************************
     203//******************************************************************************
     204
    176205void timecounter_init(struct timecounter *tc,
    177206                      const struct cyclecounter *cc,
Note: See TracChangeset for help on using the changeset viewer.