Debian Codegraph @

src/sdl/sdl_time.c

raw
1 /* ______ ___ ___
2 * /\ _ \ /\_ \ /\_ \
3 * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
4 * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
5 * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
6 * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
7 * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
8 * /\____/
9 * \_/__/
10 *
11 * SDL time driver.
12 *
13 * See LICENSE.txt for copyright information.
14 */
15 #include "SDL.h"
16
17 #include "allegro5/altime.h"
18 #include "allegro5/platform/allegro_internal_sdl.h"
19 #include "allegro5/debug.h"
20
21 ALLEGRO_DEBUG_CHANNEL("SDL")
22
23 double _al_sdl_get_time(void)
24 {
25 return 1.0 * SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency();
26 }
27
28
29
30 void _al_sdl_rest(double seconds)
31 {
32 SDL_Delay(seconds * 1000);
33 }
34
35
36
37 void _al_sdl_init_timeout(ALLEGRO_TIMEOUT *timeout, double seconds)
38 {
39 ALLEGRO_TIMEOUT_SDL *timeout_sdl = (void *)timeout;
40 timeout_sdl->ms = seconds * 1000;
41 }
42
43 /* vim: set sts=3 sw=3 et */