Changeset 231b3fd in mainline for uspace/drv/nic/rtl8139/general.c


Ignore:
Timestamp:
2018-08-25T21:35:26Z (6 years ago)
Author:
GitHub <noreply@…>
Parents:
e2625b1a (diff), 3c45353 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jakub Jermář <jakub@…> (2018-08-25 21:35:26)
git-committer:
GitHub <noreply@…> (2018-08-25 21:35:26)
Message:

Merge 3c453534a2b093c8039d8e8059b923c71f3492a3 into e2625b1a1e5a2895b86f0e39c2d70a39e49e042a

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/rtl8139/general.c

    re2625b1a r231b3fd  
    8585 */
    8686errno_t rtl8139_timer_act_init(rtl8139_timer_act_t *ta, uint32_t timer_freq,
    87     const struct timeval *time)
     87    const struct timespec *time)
    8888{
    8989        if (!ta || timer_freq == 0 || !time)
     
    9595        ta->full_val = seconds_in_reg * tics_per_ms * 1000;
    9696
    97         struct timeval remains = *time;
     97        struct timespec remains = *time;
    9898        ta->full_skips = remains.tv_sec / seconds_in_reg;
    9999        remains.tv_sec = remains.tv_sec % seconds_in_reg;
    100100
    101         if (remains.tv_usec > RTL8139_USEC_IN_SEC) {
    102                 remains.tv_sec += remains.tv_usec / RTL8139_USEC_IN_SEC;
    103                 remains.tv_usec = remains.tv_usec % RTL8139_USEC_IN_SEC;
     101        if (NSEC2USEC(remains.tv_nsec) > RTL8139_USEC_IN_SEC) {
     102                remains.tv_sec += NSEC2USEC(remains.tv_nsec) / RTL8139_USEC_IN_SEC;
     103                remains.tv_nsec = NSEC2USEC(remains.tv_nsec) % RTL8139_USEC_IN_SEC;
    104104
    105105                /* it can be increased above seconds_in_reg again */
     
    108108        }
    109109
    110         ta->last_val = remains.tv_sec * 1000 + remains.tv_usec / 1000;
     110        ta->last_val = SEC2MSEC(remains.tv_sec) + NSEC2MSEC(remains.tv_nsec);
    111111        ta->last_val *= tics_per_ms;
    112112
Note: See TracChangeset for help on using the changeset viewer.