d09a1c39f9
Implements the posix clock_nanosleep function, where both relative and absolute sleeps are made as absolute sleeps. The nanosleep() function is a special case of clock_nanosleep(), and so has been refactored to simply call it. Signed-off-by: Tom Finet <tom.codeninja@gmail.com>
25 lines
541 B
C
25 lines
541 B
C
/*
|
|
* Copyright (c) 2018 Friedt Professional Engineering Services, Inc
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include <zephyr/kernel.h>
|
|
#include <limits.h>
|
|
#include <errno.h>
|
|
/* required for struct timespec */
|
|
#include <zephyr/posix/time.h>
|
|
#include <zephyr/sys/util.h>
|
|
#include <zephyr/sys_clock.h>
|
|
|
|
/**
|
|
* @brief Suspend execution for nanosecond intervals.
|
|
*
|
|
* See IEEE 1003.1
|
|
*/
|
|
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
|
|
{
|
|
return clock_nanosleep(CLOCK_MONOTONIC, 0, rqtp, rmtp);
|
|
}
|