Banjo API 1.0.0-rc.2
Low-level C99 game development API
Loading...
Searching...
No Matches
time.h
Go to the documentation of this file.
1
65#ifndef BJ_TIME_H
66#define BJ_TIME_H
67
68#include <banjo/api.h>
69#include <banjo/error.h>
70
80uint64_t bj_get_time(
81 void
82);
83
96 int milliseconds
97);
98
110 void
111);
112
125 void
126);
127
139 void
140);
141
150{
151 uint64_t start_counter;
152 uint64_t last_tick;
153};
154
166 struct bj_stopwatch* stopwatch
167);
168
181 struct bj_stopwatch* stopwatch
182);
183
197 const struct bj_stopwatch* stopwatch
198);
199
213 const struct bj_stopwatch* stopwatch
214);
215
229 struct bj_stopwatch* stopwatch
230);
231
232#endif
General-purpose definitions for Banjo API.
Recoverable error handling.
uint64_t last_tick
Time of last step/checkpoint.
Definition time.h:152
uint64_t start_counter
Time when stopwatch was last reset.
Definition time.h:151
void bj_sleep(int milliseconds)
Suspends the current thread for a specified duration.
void bj_reset_stopwatch(struct bj_stopwatch *stopwatch)
Resets the stopwatch to the current time.
double bj_step_delay_stopwatch(struct bj_stopwatch *stopwatch)
Steps the stopwatch and returns the delay since the previous step.
uint64_t bj_time_frequency(void)
Returns the frequency of the high-resolution counter.
double bj_stopwatch_delay(const struct bj_stopwatch *stopwatch)
Returns the time in seconds since the last step.
uint64_t bj_get_time(void)
Get the current system time in seconds since the Unix epoch.
double bj_run_time(void)
Gets the current time in seconds since Banjo initialisation.
uint64_t bj_time_counter(void)
Returns the current high-resolution time counter.
void bj_step_stopwatch(struct bj_stopwatch *stopwatch)
Records a step/checkpoint in time.
double bj_stopwatch_elapsed(const struct bj_stopwatch *stopwatch)
Returns the elapsed time in seconds since the stopwatch was reset.
Structure representing a simple stopwatch.
Definition time.h:150