30# define __VLC_MTIME_H 1
46#define VLC_TICK_MIN INT64_MIN
47#define VLC_TICK_MAX INT64_MAX
52#define VLC_TICK_FROM_SEC(sec) (CLOCK_FREQ * (sec))
53#define SEC_FROM_VLC_TICK(vtk) ((vtk) / CLOCK_FREQ)
60 ->
typename std::enable_if<std::is_integral<T>::value,
vlc_tick_t>::type
81#define vlc_tick_from_sec(sec) _Generic((sec), \
82 double: vlc_tick_from_secf(sec), \
83 float: vlc_tick_from_secf(sec), \
84 default: vlc_tick_from_seci(sec) )
121#if (CLOCK_FREQ % 1000) == 0
122#define VLC_TICK_FROM_MS(ms) ((CLOCK_FREQ / INT64_C(1000)) * (ms))
123#define MS_FROM_VLC_TICK(vtk) ((vtk) / (CLOCK_FREQ / INT64_C(1000)))
124#elif (1000 % CLOCK_FREQ) == 0
125#define VLC_TICK_FROM_MS(ms) ((ms) / (INT64_C(1000) / CLOCK_FREQ))
126#define MS_FROM_VLC_TICK(vtk) ((vtk) * (INT64_C(1000) / CLOCK_FREQ))
128#define VLC_TICK_FROM_MS(ms) (CLOCK_FREQ * (ms) / 1000)
129#define MS_FROM_VLC_TICK(vtk) ((vtk) * 1000 / CLOCK_FREQ)
136#if (CLOCK_FREQ % 1000000) == 0
137#define VLC_TICK_FROM_US(us) ((CLOCK_FREQ / INT64_C(1000000)) * (us))
138#define US_FROM_VLC_TICK(vtk) ((vtk) / (CLOCK_FREQ / INT64_C(1000000)))
139#elif (1000000 % CLOCK_FREQ) == 0
140#define VLC_TICK_FROM_US(us) ((us) / (INT64_C(1000000) / CLOCK_FREQ))
141#define US_FROM_VLC_TICK(vtk) ((vtk) * (INT64_C(1000000) / CLOCK_FREQ))
143#define VLC_TICK_FROM_US(us) (CLOCK_FREQ * (us) / INT64_C(1000000))
144#define US_FROM_VLC_TICK(vtk) ((vtk) * INT64_C(1000000) / CLOCK_FREQ)
151#if (CLOCK_FREQ % 1000000000) == 0
152#define VLC_TICK_FROM_NS(ns) ((ns) * (CLOCK_FREQ / (INT64_C(1000000000))))
153#define NS_FROM_VLC_TICK(vtk) ((vtk) / (CLOCK_FREQ / (INT64_C(1000000000))))
154#elif (1000000000 % CLOCK_FREQ) == 0
155#define VLC_TICK_FROM_NS(ns) ((ns) / (INT64_C(1000000000) / CLOCK_FREQ))
156#define NS_FROM_VLC_TICK(vtk) ((vtk) * (INT64_C(1000000000) / CLOCK_FREQ))
158#define VLC_TICK_FROM_NS(ns) (CLOCK_FREQ * (ns) / INT64_C(1000000000))
159#define NS_FROM_VLC_TICK(vtk) ((vtk) * INT64_C(1000000000) / CLOCK_FREQ)
168#define MSFTIME_FROM_SEC(sec) (INT64_C(10000000) * (sec))
169#define MSFTIME_FROM_MS(sec) (INT64_C(10000) * (sec))
171#if (CLOCK_FREQ % 10000000) == 0
172#define VLC_TICK_FROM_MSFTIME(msft) ((msft) * (CLOCK_FREQ / INT64_C(10000000))
173#define MSFTIME_FROM_VLC_TICK(vtk) ((vtk) / (CLOCK_FREQ / INT64_C(10000000))
174#elif (10000000 % CLOCK_FREQ) == 0
175#define VLC_TICK_FROM_MSFTIME(msft) ((msft) / (INT64_C(10000000) / CLOCK_FREQ))
176#define MSFTIME_FROM_VLC_TICK(vtk) ((vtk) * (INT64_C(10000000) / CLOCK_FREQ))
178#define VLC_TICK_FROM_MSFTIME(msft) (CLOCK_FREQ * (msft) / INT64_C(10000000))
179#define MSFTIME_FROM_VLC_TICK(vtk) ((vtk) * INT64_C(10000000) / CLOCK_FREQ)
182#define vlc_tick_from_timeval(tv) \
183 (vlc_tick_from_sec( (tv)->tv_sec ) + VLC_TICK_FROM_US( (tv)->tv_usec ))
185#define vlc_tick_from_timespec(tv) \
186 (vlc_tick_from_sec( (tv)->tv_sec ) + VLC_TICK_FROM_NS( (tv)->tv_nsec ))
205#define MSTRTIME_MAX_SIZE 22
268 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:266
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:278
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:235
uint32_t i_divider_num
Definition: vlc_tick.h:237
uint32_t i_remainder
Definition: vlc_tick.h:239
vlc_tick_t date
Definition: vlc_tick.h:236
uint32_t i_divider_den
Definition: vlc_tick.h:238
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:529
This file is a collection of common definitions and types.
#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:94
uint64_t NTPtime64(void)
Definition: mtime.c:131
int64_t vlc_tick_t
High precision date or time interval.
Definition: vlc_tick.h:45
static vlc_tick_t vlc_tick_from_secf(double secf)
Definition: vlc_tick.h:77
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:112
static int64_t samples_from_vlc_tick(vlc_tick_t t, unsigned samp_rate)
Definition: vlc_tick.h:106
#define vlc_tick_from_sec(sec)
Definition: vlc_tick.h:82
static double secf_from_vlc_tick(vlc_tick_t vtk)
Definition: vlc_tick.h:89
static vlc_tick_t vlc_tick_from_samples(int64_t samples, unsigned samp_rate)
Definition: vlc_tick.h:102
int64_t msftime_t
Definition: vlc_tick.h:167
static vlc_tick_t vlc_tick_from_seci(int64_t sec)
Definition: vlc_tick.h:72