From: Bartosz Golaszewski Date: Sat, 24 Jun 2017 10:43:00 +0000 (+0200) Subject: core: kill nsec_to_timespec() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4d0a04330025e827f8d0284bc0571b3bebc03cd6;p=qemu-gpiodev%2Flibgpiod.git core: kill nsec_to_timespec() This function is tiny and only used in one place. Signed-off-by: Bartosz Golaszewski --- diff --git a/src/lib/core.c b/src/lib/core.c index 3c9ed21..c123028 100644 --- a/src/lib/core.c +++ b/src/lib/core.c @@ -74,12 +74,6 @@ static bool is_unsigned_int(const char *str) return *str == '\0'; } -static void nsec_to_timespec(uint64_t nsec, struct timespec *ts) -{ - ts->tv_sec = nsec / 1000000000ULL; - ts->tv_nsec = (nsec % 1000000000ULL); -} - int gpiod_simple_get_value_multiple(const char *consumer, const char *device, const unsigned int *offsets, int *values, unsigned int num_lines, bool active_low) @@ -881,7 +875,9 @@ int gpiod_line_event_read_fd(int fd, struct gpiod_line_event *event) event->event_type = evdata.id == GPIOEVENT_EVENT_RISING_EDGE ? GPIOD_EVENT_RISING_EDGE : GPIOD_EVENT_FALLING_EDGE; - nsec_to_timespec(evdata.timestamp, &event->ts); + + event->ts.tv_sec = evdata.timestamp / 1000000000ULL; + event->ts.tv_nsec = evdata.timestamp % 1000000000ULL; return 0; }