Rizin
unix-like reverse engineering framework and cli tools
clock.h File Reference
#include <stdint.h>
#include <time.h>

Go to the source code of this file.

Typedefs

typedef uint64_t TSDuration
 
typedef uint64_t TSClock
 

Functions

static TSDuration duration_from_micros (uint64_t micros)
 
static uint64_t duration_to_micros (TSDuration self)
 
static TSClock clock_null (void)
 
static TSClock clock_now (void)
 
static TSClock clock_after (TSClock base, TSDuration duration)
 
static bool clock_is_null (TSClock self)
 
static bool clock_is_gt (TSClock self, TSClock other)
 

Typedef Documentation

◆ TSClock

typedef uint64_t TSClock

Definition at line 109 of file clock.h.

◆ TSDuration

Definition at line 6 of file clock.h.

Function Documentation

◆ clock_after()

static TSClock clock_after ( TSClock  base,
TSDuration  duration 
)
inlinestatic

Definition at line 127 of file clock.h.

127  {
128  return base + duration;
129 }

Referenced by ts_parser_parse().

◆ clock_is_gt()

static bool clock_is_gt ( TSClock  self,
TSClock  other 
)
inlinestatic

Definition at line 135 of file clock.h.

135  {
136  return self > other;
137 }

Referenced by ts_parser__advance().

◆ clock_is_null()

static bool clock_is_null ( TSClock  self)
inlinestatic

Definition at line 131 of file clock.h.

131  {
132  return !self;
133 }

Referenced by ts_parser__advance().

◆ clock_now()

static TSClock clock_now ( void  )
inlinestatic

Definition at line 123 of file clock.h.

123  {
124  return (uint64_t)clock();
125 }
unsigned long uint64_t
Definition: sftypes.h:28

Referenced by ts_parser__advance(), and ts_parser_parse().

◆ clock_null()

static TSClock clock_null ( void  )
inlinestatic

Definition at line 119 of file clock.h.

119  {
120  return 0;
121 }

Referenced by ts_parser_new(), and ts_parser_parse().

◆ duration_from_micros()

static TSDuration duration_from_micros ( uint64_t  micros)
inlinestatic

Definition at line 111 of file clock.h.

111  {
112  return micros * (uint64_t)CLOCKS_PER_SEC / 1000000;
113 }

Referenced by ts_parser_set_timeout_micros().

◆ duration_to_micros()

static uint64_t duration_to_micros ( TSDuration  self)
inlinestatic

Definition at line 115 of file clock.h.

115  {
116  return self * 1000000 / (uint64_t)CLOCKS_PER_SEC;
117 }

Referenced by ts_parser_timeout_micros().