source: rtems/cpukit/score/src/timespecisvalid.c @ 484a769

4.104.114.95
Last change on this file since 484a769 was 484a769, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/04/08 at 17:46:39

Convert to "bool".

  • Property mode set to 100644
File size: 746 bytes
Line 
1/**
2 *  @file  score/src/timespecisvalid.c
3 */
4
5/*
6 *  COPYRIGHT (c) 1989-2007.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#if HAVE_CONFIG_H
17#include "config.h"
18#endif
19
20#include <sys/types.h>
21
22#include <rtems/system.h>
23#include <rtems/score/timespec.h>
24#include <rtems/score/tod.h>
25
26bool _Timespec_Is_valid(
27  const struct timespec *time
28)
29{
30  if ( !time )
31    return FALSE;
32
33  if ( time->tv_sec < 0 )
34    return FALSE;
35
36  if ( time->tv_nsec < 0 )
37    return FALSE;
38
39  if ( time->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
40    return FALSE;
41
42  return TRUE;
43}
Note: See TracBrowser for help on using the repository browser.