Changeset 205f1add in mainline for uspace/lib/nic/src/nic_impl.c


Ignore:
Timestamp:
2018-08-23T21:14:56Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Children:
f33c989e
Parents:
e2625b1a
git-author:
Jakub Jermar <jakub@…> (2018-08-21 21:58:52)
git-committer:
Jakub Jermar <jakub@…> (2018-08-23 21:14:56)
Message:

Get rid of sys/time.h

This commit moves the POSIX-like time functionality from libc's
sys/time.h to libposix and introduces C99-like or HelenOS-specific
interfaces to libc.

Specifically, use of sys/time.h, struct timeval, suseconds_t and
gettimeofday is replaced by time.h (C99), struct timespec (C99),
usec_t (HelenOS) and getuptime / getrealtime (HelenOS).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/src/nic_impl.c

    re2625b1a r205f1add  
    121121                nic_data->poll_mode = nic_data->default_poll_mode;
    122122                memcpy(&nic_data->poll_period, &nic_data->default_poll_period,
    123                     sizeof(struct timeval));
     123                    sizeof(struct timespec));
    124124                if (rc != EOK) {
    125125                        /*
     
    714714 */
    715715errno_t nic_poll_get_mode_impl(ddf_fun_t *fun,
    716     nic_poll_mode_t *mode, struct timeval *period)
     716    nic_poll_mode_t *mode, struct timespec *period)
    717717{
    718718        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    719719        fibril_rwlock_read_lock(&nic_data->main_lock);
    720720        *mode = nic_data->poll_mode;
    721         memcpy(period, &nic_data->poll_period, sizeof(struct timeval));
     721        memcpy(period, &nic_data->poll_period, sizeof(struct timespec));
    722722        fibril_rwlock_read_unlock(&nic_data->main_lock);
    723723        return EOK;
     
    737737 */
    738738errno_t nic_poll_set_mode_impl(ddf_fun_t *fun,
    739     nic_poll_mode_t mode, const struct timeval *period)
     739    nic_poll_mode_t mode, const struct timespec *period)
    740740{
    741741        nic_t *nic_data = nic_get_from_ddf_fun(fun);
     
    753753                if (period == NULL)
    754754                        return EINVAL;
    755                 if (period->tv_sec == 0 && period->tv_usec == 0)
     755                if (period->tv_sec == 0 && period->tv_nsec == 0)
    756756                        return EINVAL;
    757                 if (period->tv_sec < 0 || period->tv_usec < 0)
     757                if (period->tv_sec < 0 || period->tv_nsec < 0)
    758758                        return EINVAL;
    759759        }
Note: See TracChangeset for help on using the changeset viewer.