SAF
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1/* timer.h - Cross-platform timer library - Public Domain - 2011 Mattias Jansson / Rampant Pixels
2 *
3 * This library provides a cross-platform interface to measure
4 * elapsed time with (at least) millisecond accuracy.
5 *
6 * This library is put in the public domain; you can redistribute
7 * it and/or modify it without any restrictions.
8 *
9 */
10
11#pragma once
12
16#if TIMER_COMPILE
17#define TIMER_API
18#else
19#if __cplusplus
20#define TIMER_API extern "C"
21#else
22#define TIMER_API extern
23#endif
24#endif
25
26#if defined( _WIN32 ) || defined( _WIN64 )
27
29typedef unsigned __int64 tick_t;
30
31#else
32
33#include <stdint.h>
35typedef uint64_t tick_t;
36
37#endif
38
40//typedef float deltatime_t;
41typedef double deltatime_t;
42
43
45TIMER_API int timer_lib_initialize( void );
46
48TIMER_API void timer_lib_shutdown( void );
49
53TIMER_API tick_t timer_current( void );
54
58TIMER_API deltatime_t timer_elapsed( const tick_t t );
59
63TIMER_API tick_t timer_elapsed_ticks( const tick_t t );
64
68
73
76TIMER_API tick_t timer_system( void );
77
TIMER_API tick_t timer_system(void)
uint64_t tick_t
Tick type.
Definition timer.h:35
TIMER_API tick_t timer_elapsed_ticks(const tick_t t)
TIMER_API deltatime_t timer_elapsed(const tick_t t)
double deltatime_t
Deltatime type (float or double)
Definition timer.h:41
TIMER_API tick_t timer_current(void)
TIMER_API int timer_lib_initialize(void)
TIMER_API tick_t timer_ticks_per_second(void)
TIMER_API void timer_lib_shutdown(void)
TIMER_API deltatime_t timer_ticks_to_seconds(const tick_t dt)