summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/nanosleep.c
blob: 167dcbc78748ed152194580baa72bb321867d507 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
 * @file
 *
 * @ingroup POSIXAPI
 *
 * @brief Suspends Execution of calling thread until Time elapses
 */

/*
 *  COPYRIGHT (c) 1989-2015.
 *  On-Line Applications Research Corporation (OAR).
 * 
 *  Copyright (c) 2016. Gedare Bloom.
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <time.h>

#include <rtems/seterr.h>

/*
 *  14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
 */
int nanosleep(
  const struct timespec  *rqtp,
  struct timespec        *rmtp
)
{
  int eno;

  eno = clock_nanosleep( CLOCK_REALTIME, 0, rqtp, rmtp );

  if ( eno != 0 ) {
    rtems_set_errno_and_return_minus_one( eno );
  }

  return eno;
}