00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _RTEMS_SCORE_TIMESPEC_H
00019 #define _RTEMS_SCORE_TIMESPEC_H
00020
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032
00033 #include <sys/types.h>
00034 #include <rtems/score/tod.h>
00035 #include <rtems/score/watchdog.h>
00036
00046 boolean _Timespec_Is_valid(
00047 const struct timespec *time
00048 );
00049
00060 boolean _Timespec_Less_than(
00061 const struct timespec *lhs,
00062 const struct timespec *rhs
00063 );
00064
00075 boolean _Timespec_Greater_than(
00076 const struct timespec *lhs,
00077 const struct timespec *rhs
00078 );
00079
00090 #define _Timespec_Equal_to( lhs, rhs ) \
00091 ( ((lhs)->tv_sec == (rhs)->tv_sec) && \
00092 ((lhs)->tv_nsec == (rhs)->tv_nsec) \
00093 )
00094
00105 uint32_t _Timespec_Add_to(
00106 struct timespec *time,
00107 const struct timespec *add
00108 );
00109
00119 uint32_t _Timespec_To_ticks(
00120 const struct timespec *time
00121 );
00122
00131 void _Timespec_From_ticks(
00132 uint32_t ticks,
00133 struct timespec *time
00134 );
00135
00147 void _Timespec_Subtract(
00148 const struct timespec *start,
00149 const struct timespec *end,
00150 struct timespec *result
00151 );
00152
00165 void _Timespec_Divide_by_integer(
00166 const struct timespec *time,
00167 uint32_t iterations,
00168 struct timespec *result
00169 );
00170
00183 void _Timespec_Divide(
00184 const struct timespec *lhs,
00185 const struct timespec *rhs,
00186 uint32_t *ival_percentage,
00187 uint32_t *fval_percentage
00188 );
00189
00190 #ifdef __cplusplus
00191 }
00192 #endif
00193
00196 #endif
00197