C++ TargetRTS
Loading...
Searching...
No Matches
RTTimespec.h
1/*
2 * Licensed Materials - Property of HCL and/or IBM
3 * Copyright HCL Technologies Ltd. 2016, 2021. All Rights Reserved.
4 * Copyright IBM Corporation 1999, 2016. All Rights Reserved.
5 *
6 * U.S. Government Users Restricted Rights - Use, duplication or
7 * disclosure restricted by GSA ADP Schedule.
8 */
9
10#ifndef __RTTimespec_h__
11#define __RTTimespec_h__ included
12
13#ifdef PRAGMA
14#pragma interface
15#endif
16
17#ifndef __RTObject_class_h__
18#include <RTObject_class.h>
19#endif
20
21class RTInterval;
22class RTTime;
23
29{
31 long tv_sec;
33 long tv_nsec;
34
36 RTS_INLINE RTTimespec( void );
37
42 RTS_INLINE RTTimespec( long s, long ns);
43
44 RTTimespec( const RTInterval & ); //lint !e1931
45 RTTimespec( const RTTime & ); //lint !e1931
46 RTS_INLINE RTTimespec( const RTTimespec & );
47
52 void normalize( void );
53
54 RTS_INLINE RTTimespec & operator=( const RTTimespec & );
55
56 RTTimespec & operator+=( const RTTimespec & );
57 RTTimespec & operator-=( const RTTimespec & );
58
64 long ticksFromNow( long nanoseconds_per_tick ) const;
65
69 static void getclock( RTTimespec & tspec);
70
72 static const RTTimespec zero;
73
76
77#define RTType_RTTimespec ( RTTimespec::classData )
78};
79
80RTS_INLINE int operator==( const RTTimespec &, const RTTimespec & );
81RTS_INLINE int operator!=( const RTTimespec &, const RTTimespec & );
82RTS_INLINE int operator<=( const RTTimespec &, const RTTimespec & );
83RTS_INLINE int operator> ( const RTTimespec &, const RTTimespec & );
84RTS_INLINE int operator>=( const RTTimespec &, const RTTimespec & );
85RTS_INLINE int operator< ( const RTTimespec &, const RTTimespec & );
86RTTimespec operator+ ( const RTTimespec &, const RTTimespec & );
87RTTimespec operator- ( const RTTimespec &, const RTTimespec & );
88
90{
91 const void * data;
92 const RTObject_class * type;
93
94 RTS_INLINE RTTypedValue_RTTimespec( const RTTimespec & ); //lint !e1931
95 RTS_INLINE RTTypedValue_RTTimespec( const RTTimespec &,
96 const RTObject_class * );
97}; //lint !e1712
98
99#if RTS_INLINES
100#include <RTTimespec.inl>
101#endif
102
103#endif // __RTTimespec_h__
Definition: RTInterval.h:26
Definition: RTTime.h:32
A type descriptor providing information about a type.
Definition: RTObject_class.h:64
A time value which can represent either an absolute or relative time.
Definition: RTTimespec.h:29
void normalize(void)
Normalize the time value so that as many seconds as possible are stored in the tv_sec field and remai...
long tv_sec
Seconds.
Definition: RTTimespec.h:31
long ticksFromNow(long nanoseconds_per_tick) const
Get the number of "ticks" which is between this time value and the current time.
RTTimespec(void)
Construct a zero time value.
Definition: RTTimespec.inl:21
long tv_nsec
Nanoseconds.
Definition: RTTimespec.h:33
static void getclock(RTTimespec &tspec)
Get the current time.
static const RTTimespec zero
Static constant for a zero time value.
Definition: RTTimespec.h:72
static const RTObject_class classData
Type descriptor for an RTTimespec.
Definition: RTTimespec.h:75
Definition: RTTimespec.h:90