ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
time.c File Reference

⏱️ High-precision timing utilities implementation More...

Go to the source code of this file.

Macros

#define SOKOL_IMPL
 

Functions

bool timer_system_init (void)
 Initialize the timing system.
 
void timer_system_cleanup (void)
 Cleanup the timing system.
 
bool timer_start (const char *name)
 Start a named timer.
 
double timer_stop (const char *name)
 Stop a named timer and return elapsed time.
 
bool timer_is_initialized (void)
 Check if timing system is initialized.
 
int format_duration_ns (double nanoseconds, char *buffer, size_t buffer_size)
 Format nanoseconds as human-readable duration string.
 
int format_duration_ms (double milliseconds, char *buffer, size_t buffer_size)
 Format milliseconds as human-readable duration string.
 
int format_duration_s (double seconds, char *buffer, size_t buffer_size)
 Format seconds as human-readable duration string.
 
void adaptive_sleep_init (adaptive_sleep_state_t *state, const adaptive_sleep_config_t *config)
 Initialize adaptive sleep state with configuration.
 
uint64_t adaptive_sleep_calculate (adaptive_sleep_state_t *state, size_t queue_depth, size_t target_depth)
 Calculate adaptive sleep time based on queue depth.
 
void adaptive_sleep_do (adaptive_sleep_state_t *state, size_t queue_depth, size_t target_depth)
 Calculate sleep time and immediately sleep for that duration.
 

Detailed Description

⏱️ High-precision timing utilities implementation

Definition in file time.c.

Macro Definition Documentation

◆ SOKOL_IMPL

#define SOKOL_IMPL

Definition at line 7 of file time.c.

Variable Documentation

◆ initialized

bool initialized

Initialization state.

Definition at line 29 of file time.c.

◆ rwlock

rwlock_t rwlock

Read-write lock for thread-safe access (uthash requires external locking)

Definition at line 28 of file time.c.

◆ timers

timer_record_t* timers

Hash table of active timers (uthash head pointer)

Definition at line 27 of file time.c.