NESe (pronounced "Nessie") is a NES emulator based on the e6502 emulator, also written in C with a focus on speed and portability for use on embedded platforms, especially ARM.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #include <time.h>
-
- #include "time.h"
-
- #include <SDL2/SDL.h>
-
-
- void time_get(struct timespec* ts) {
- uint64_t time = SDL_GetTicks64();
- ts->tv_sec = time / 1000U;
- ts->tv_nsec = (time % 1000U) * 1000U * 1000U;
- }
-
- void time_sleep_until(const struct timespec* ts) {
- uint64_t t_target = ( (ts->tv_sec * 1000ULL) +
- (ts->tv_nsec / (1000U * 1000U)));
- uint64_t t_now = SDL_GetTicks64();
- if (t_target > t_now) {
- SDL_Delay(t_target - t_now);
- }
- }
|