30# define __VLC_MTIME_H 1
49#define VLC_TICK_MIN INT64_MIN
50#define VLC_TICK_MAX INT64_MAX
55#define VLC_TICK_FROM_SEC(sec) (CLOCK_FREQ * (sec))
56#define SEC_FROM_VLC_TICK(vtk) ((vtk) / CLOCK_FREQ)
63 ->
typename std::enable_if<std::is_integral<T>::value,
vlc_tick_t>::type
84#define vlc_tick_from_sec(sec) _Generic((sec), \
85 double: vlc_tick_from_secf(sec), \
86 float: vlc_tick_from_secf(sec), \
87 default: vlc_tick_from_seci(sec) )
124#if (CLOCK_FREQ % 1000) == 0
125#define VLC_TICK_FROM_MS(ms) ((CLOCK_FREQ / INT64_C(1000)) * (ms))
126#define MS_FROM_VLC_TICK(vtk) ((vtk) / (CLOCK_FREQ / INT64_C(1000)))
127#elif (1000 % CLOCK_FREQ) == 0
128#define VLC_TICK_FROM_MS(ms) ((ms) / (INT64_C(1000) / CLOCK_FREQ))
129#define MS_FROM_VLC_TICK(vtk) ((vtk) * (INT64_C(1000) / CLOCK_FREQ))
131#define VLC_TICK_FROM_MS(ms) (CLOCK_FREQ * (ms) / 1000)
132#define MS_FROM_VLC_TICK(vtk) ((vtk) * 1000 / CLOCK_FREQ)
139#if (CLOCK_FREQ % 1000000) == 0
140#define VLC_TICK_FROM_US(us) ((CLOCK_FREQ / INT64_C(1000000)) * (us))
141#define US_FROM_VLC_TICK(vtk) ((vtk) / (CLOCK_FREQ / INT64_C(1000000)))
142#elif (1000000 % CLOCK_FREQ) == 0
143#define VLC_TICK_FROM_US(us) ((us) / (INT64_C(1000000) / CLOCK_FREQ))
144#define US_FROM_VLC_TICK(vtk) ((vtk) * (INT64_C(1000000) / CLOCK_FREQ))
146#define VLC_TICK_FROM_US(us) (CLOCK_FREQ * (us) / INT64_C(1000000))
147#define US_FROM_VLC_TICK(vtk) ((vtk) * INT64_C(1000000) / CLOCK_FREQ)
154#if (CLOCK_FREQ % 1000000000) == 0
155#define VLC_TICK_FROM_NS(ns) ((ns) * (CLOCK_FREQ / (INT64_C(1000000000))))
156#define NS_FROM_VLC_TICK(vtk) ((vtk) / (CLOCK_FREQ / (INT64_C(1000000000))))
157#elif (1000000000 % CLOCK_FREQ) == 0
158#define VLC_TICK_FROM_NS(ns) ((ns) / (INT64_C(1000000000) / CLOCK_FREQ))
159#define NS_FROM_VLC_TICK(vtk) ((vtk) * (INT64_C(1000000000) / CLOCK_FREQ))
161#define VLC_TICK_FROM_NS(ns) (CLOCK_FREQ * (ns) / INT64_C(1000000000))
162#define NS_FROM_VLC_TICK(vtk) ((vtk) * INT64_C(1000000000) / CLOCK_FREQ)
171#define MSFTIME_FROM_SEC(sec) (INT64_C(10000000) * (sec))
172#define MSFTIME_FROM_MS(sec) (INT64_C(10000) * (sec))
174#if (CLOCK_FREQ % 10000000) == 0
175#define VLC_TICK_FROM_MSFTIME(msft) ((msft) * (CLOCK_FREQ / INT64_C(10000000))
176#define MSFTIME_FROM_VLC_TICK(vtk) ((vtk) / (CLOCK_FREQ / INT64_C(10000000))
177#elif (10000000 % CLOCK_FREQ) == 0
178#define VLC_TICK_FROM_MSFTIME(msft) ((msft) / (INT64_C(10000000) / CLOCK_FREQ))
179#define MSFTIME_FROM_VLC_TICK(vtk) ((vtk) * (INT64_C(10000000) / CLOCK_FREQ))
181#define VLC_TICK_FROM_MSFTIME(msft) (CLOCK_FREQ * (msft) / INT64_C(10000000))
182#define MSFTIME_FROM_VLC_TICK(vtk) ((vtk) * INT64_C(10000000) / CLOCK_FREQ)
185#define vlc_tick_from_timeval(tv) \
186 (vlc_tick_from_sec( (tv)->tv_sec ) + VLC_TICK_FROM_US( (tv)->tv_usec ))
188#define vlc_tick_from_timespec(tv) \
189 (vlc_tick_from_sec( (tv)->tv_sec ) + VLC_TICK_FROM_NS( (tv)->tv_nsec ))
208#define MSTRTIME_MAX_SIZE 22
271 date->i_remainder = 0;
size_t count
Definition core.c:403
#define VLC_USED
Definition fourcc_gen.c:32
#define VLC_API
Definition fourcc_gen.c:31
static void date_Set(date_t *restrict date, vlc_tick_t value)
Sets the exact timestamp of a date_t.
Definition vlc_tick.h:269
vlc_tick_t date_Increment(date_t *restrict date, uint32_t count)
Increments a date.
void date_Change(date_t *restrict date, uint32_t num, uint32_t den)
Changes the rate of a date_t.
void date_Init(date_t *restrict date, uint32_t num, uint32_t den)
Initializes a date_t.
static vlc_tick_t date_Get(const date_t *restrict date)
Gets the current timestamp from a date_t.
Definition vlc_tick.h:281
vlc_tick_t date_Decrement(date_t *restrict date, uint32_t count)
Decrements a date.
Timestamps without long-term rounding errors.
Definition vlc_tick.h:238
uint32_t i_divider_num
Definition vlc_tick.h:240
uint32_t i_remainder
Definition vlc_tick.h:242
vlc_tick_t date
Definition vlc_tick.h:239
uint32_t i_divider_den
Definition vlc_tick.h:241
Definition vlc_fixups.h:151
long long rem
Definition vlc_fixups.h:153
long long quot
Definition vlc_fixups.h:152
Definition vlc_fixups.h:532
This file is a collection of common definitions and types.
This file defines of values used in interface, vout, aout and vlc core functions.
#define CLOCK_FREQ
Definition vlc_config.h:47
lldiv_t lldiv(long long, long long)
static vlc_tick_t vlc_tick_rate_duration(float frame_rate)
Definition vlc_tick.h:97
int64_t vlc_tick_t
High precision date or time interval.
Definition vlc_tick.h:48
static vlc_tick_t vlc_tick_from_secf(double secf)
Definition vlc_tick.h:80
char * vlc_tick_to_str(char *psz_buffer, vlc_tick_t ticks)
Convert seconds to a time in the format h:mm:ss.
Definition mtime.c:42
struct timespec * vlc_tick_to_timespec(struct timespec *restrict ts, vlc_tick_t tick)
Converts a VLC tick to a POSIX time specification.
Definition mtime.c:148
static vlc_tick_t vlc_tick_from_frac(uint64_t num, uint64_t den)
Definition vlc_tick.h:115
static int64_t samples_from_vlc_tick(vlc_tick_t t, unsigned samp_rate)
Definition vlc_tick.h:109
#define vlc_tick_from_sec(sec)
Definition vlc_tick.h:85
static double secf_from_vlc_tick(vlc_tick_t vtk)
Definition vlc_tick.h:92
static vlc_tick_t vlc_tick_from_samples(int64_t samples, unsigned samp_rate)
Definition vlc_tick.h:105
int64_t msftime_t
Definition vlc_tick.h:170
static vlc_tick_t vlc_tick_from_seci(int64_t sec)
Definition vlc_tick.h:75
uint64_t vlc_ntp_time(void)
Gets the current wallclock time as 64-bit NTP timestamp.
Definition mtime.c:131