68 struct timeval curr_time;
69 gettimeofday(&curr_time, NULL);
81 long long new_nsec =
ts->tv_nsec +
offset;
84 ts->tv_nsec = new_nsec;
97double tv_diff(
struct timeval curr_time,
struct timeval prev_time)
102 ct = (double)curr_time.tv_sec +
103 (((
double)curr_time.tv_usec) / 1000000.0);
104 pt = (double)prev_time.tv_sec +
105 (((
double)prev_time.tv_usec) / 1000000.0);
109uint32_t
tv_diff_usec(
struct timeval curr_time,
struct timeval prev_time)
112 uint32_t tmp, tmp1, tmp2;
115 if (curr_time.tv_sec < prev_time.tv_sec ||
116 (curr_time.tv_sec == prev_time.tv_sec && curr_time.tv_usec < prev_time.tv_usec)) {
121 tmp1 = (curr_time.tv_sec - prev_time.tv_sec) * ((uint32_t) 1000000);
122 tmp2 = curr_time.tv_usec - prev_time.tv_usec;
137 long long new_usec =
ts->tv_usec +
offset;
140 ts->tv_usec = new_usec;
149 ts->tv_sec += d.quot;
153int tv_gt(
struct timeval a,
struct timeval b)
156 if (a.tv_sec > b.tv_sec) {
159 if (a.tv_sec < b.tv_sec) {
162 assert(a.tv_sec == b.tv_sec);
163 return a.tv_usec > b.tv_usec;
173 struct timeval vtime;
175 struct timeval atime;
206 double vrate = 90000;
208 unsigned nextSecsIncrement;
209 static struct timeval t0;
210 struct timeval tcurr;
214 gettimeofday(&t0, NULL);
224 gettimeofday(&tcurr, NULL);
226 nextSecsIncrement = (long) nextFraction;
235#if !defined HAVE_TIMESPEC_GET
238 struct timeval tv = { 0, 0 };
239 gettimeofday(&tv, NULL);
240 ts->tv_sec = tv.tv_sec;
241 ts->tv_nsec = tv.tv_usec * 1000L;
static __device__ const float offset
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_WARNING
less severe errors
struct __attribute__((packed))
struct timeval start_time
uint32_t random_startime_offset
uint32_t tv_diff_usec(struct timeval curr_time, struct timeval prev_time)
uint32_t get_local_mediatime_offset(void)
static uint32_t random_offset
void ts_add_nsec(struct timespec *ts, long long offset)
static void init_first(void)
uint32_t get_std_video_local_mediatime(void)
std_time_struct standard_time
void tv_add_usec(struct timeval *ts, long long offset) __attribute__((always_inline))
void tv_add(struct timeval *ts, double offset_secs)
pthread_once_t once_control
int timespec_get(struct timespec *ts, int base)
int tv_gt(struct timeval a, struct timeval b)
static struct timeval start_time
uint32_t get_std_audio_local_mediatime(double samples, int rate)
double tv_diff(struct timeval curr_time, struct timeval prev_time)
uint32_t get_local_mediatime(void)