1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/posix_time/main.c
Gaëtan Harter ed27d3b68b
tests/posix_time: use test_utils_interactive_sync
Use test_utils_interactive_sync for synchronizing test instead of the
custom 'getchar' handling.
2019-08-15 12:26:28 +02:00

50 lines
971 B
C

/*
* Copyright (C) 2014-17 Freie Universität Berlin
*
* 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.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Posix sleep test application
*
* @author Christian Mehlis <mehlis@inf.fu-berlin.de>
* @author Martine Lenders <m.lenders@fu-berlin.de>
*
* @}
*/
/* needed for posix usleep */
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600
#endif
#include <stdio.h>
#include <unistd.h>
#include "test_utils/interactive_sync.h"
int main(void)
{
test_utils_interactive_sync();
puts("5 x usleep(i++ * 500000)");
for (unsigned i = 0; i < 5; i++) {
useconds_t us = i * 500000u;
usleep(us);
puts("wake up");
}
puts("5 x sleep(i++)");
for (unsigned i = 0; i < 5; i++) {
sleep(i);
puts("wake up");
}
puts("DONE");
return 0;
}