2015-11-20 00:41:55 +01:00
|
|
|
/**
|
|
|
|
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2018-06-01 13:19:39 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2020-10-26 11:54:42 +01:00
|
|
|
* @ingroup posix
|
2015-11-20 00:41:55 +01:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
* @file
|
2020-10-26 22:43:47 +01:00
|
|
|
* @brief posix sleep/usleep implementation wrapped around @ref ztimer
|
2015-11-20 00:41:55 +01:00
|
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2020-10-26 22:43:47 +01:00
|
|
|
#include "kernel_defines.h"
|
|
|
|
#include "timex.h"
|
|
|
|
#include "ztimer.h"
|
2015-11-20 00:41:55 +01:00
|
|
|
|
|
|
|
unsigned int sleep(unsigned int seconds)
|
|
|
|
{
|
2020-10-26 22:43:47 +01:00
|
|
|
ztimer_sleep(ZTIMER_MSEC, seconds * MS_PER_SEC);
|
2015-11-20 00:41:55 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int usleep(useconds_t usec)
|
|
|
|
{
|
2020-10-26 22:43:47 +01:00
|
|
|
ztimer_sleep(ZTIMER_USEC, usec);
|
2015-11-20 00:41:55 +01:00
|
|
|
return 0;
|
|
|
|
}
|