Banjo API 1.1.0-alpha
Low-level C99 game development API
Loading...
Searching...
No Matches
time.h
Go to the documentation of this file.
1
62#ifndef BJ_TIME_H
63#define BJ_TIME_H
64
65#include <banjo/api.h>
66#include <banjo/error.h>
67
78 void
79);
80
94 int milliseconds
95);
96
98BANJO_EXPORT void bj_sleep(int milliseconds);
99
113 void
114);
115
128 void
129);
130
142 void
143);
144
153{
154 uint64_t start_counter;
155 uint64_t last_tick;
156};
157
169 struct bj_stopwatch* stopwatch
170);
171
187 struct bj_stopwatch* stopwatch
188);
189
203 const struct bj_stopwatch* stopwatch
204);
205
207BANJO_EXPORT double bj_stopwatch_elapsed(const struct bj_stopwatch* stopwatch);
208
222 const struct bj_stopwatch* stopwatch
223);
224
226BANJO_EXPORT double bj_stopwatch_delay(const struct bj_stopwatch* stopwatch);
227
231
232#endif
General-purpose definitions for Banjo API.
Recoverable error handling.
#define BANJO_EXPORT
Definition api.h:179
uint64_t last_tick
Time of last step/checkpoint.
Definition time.h:155
uint64_t start_counter
Time when stopwatch was last reset.
Definition time.h:154
double bj_step_stopwatch(struct bj_stopwatch *stopwatch)
Record a step and return the seconds since the previous step.
void bj_sleep(int milliseconds)
void bj_reset_stopwatch(struct bj_stopwatch *stopwatch)
Resets the stopwatch to the current time.
double bj_stopwatch_split(const struct bj_stopwatch *stopwatch)
Return the seconds since the last step, without recording one.
double bj_step_delay_stopwatch(struct bj_stopwatch *stopwatch)
uint64_t bj_time_frequency(void)
Returns the frequency of the high-resolution counter.
double bj_stopwatch_delay(const struct bj_stopwatch *stopwatch)
uint64_t bj_get_time(void)
Get the current system time in seconds since the Unix epoch.
void bj_sleep_ms(int milliseconds)
Suspend the current thread for at least the given number of milliseconds.
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.
double bj_stopwatch_total(const struct bj_stopwatch *stopwatch)
Return the seconds elapsed since the stopwatch was last reset.
double bj_stopwatch_elapsed(const struct bj_stopwatch *stopwatch)
Structure representing a simple stopwatch.
Definition time.h:153