ScummVM API documentation
time.h
1 #pragma once
2 #include <wiiu/types.h>
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #define OSOneSecond ((OSGetSystemInfo()->clockSpeed) / 4)
9 #define OSMilliseconds(val) ((((uint64_t)(val)) * (uint64_t)(OSOneSecond)) / 1000ull)
10 #define OSMicroseconds(val) ((((uint64_t)(val)) * (uint64_t)(OSOneSecond)) / 1000000ull)
11 #define OSNanoseconds(val) ((((uint64_t)(val)) * (uint64_t)(OSOneSecond)) / 1000000000ull)
12 
13 #define wiiu_bus_clock (17 * 13 * 5*5*5 * 5*5*5 * 3*3 * 2*2*2) /* 248.625000 Mhz */
14 #define wiiu_cpu_clock (17 * 13 * 5*5*5 * 5*5*5 * 5 * 3*3 * 2*2*2) /* 1243.125000 Mhz */
15 #define wiiu_timer_clock (17 * 13 * 5*5*5 * 5*5*5 * 3*3 * 2) /* 62.156250 Mhz */
16 
17 #define sec_to_ticks(s) (((17 * 13 * 5*5*5 * 5*5*5 * 3*3 * 2) * (uint64_t)(s)))
18 #define ms_to_ticks(ms) (((17 * 13 * 5*5*5 * 3*3) * (uint64_t)(ms)) / (2*2))
19 #define us_to_ticks(us) (((17 * 13 * 3*3) * (uint64_t)(us)) / (2*2* 2*2*2))
20 #define ns_to_ticks(ns) (((17 * 13 * 3*3) * (uint64_t)(ns)) / (2*2* 2*2*2* 2*2*2 *5*5*5))
21 
22 #define ticks_to_sec(ticks) (((uint64_t)(ticks)) / (17 * 13 * 5*5*5 * 5*5*5 * 3*3 * 2))
23 #define ticks_to_ms(ticks) (((uint64_t)(ticks) * (2*2)) / (17 * 13 * 5*5*5 * 3*3))
24 #define ticks_to_us(ticks) (((uint64_t)(ticks) * (2*2 * 2*2*2)) / (17 * 13 * 3*3))
25 #define ticks_to_ns(ticks) (((uint64_t)(ticks) * (2*2 * 2*2*2 * 2*2*2 * 5*5*5)) / (17 * 13 * 3*3))
26 
27 typedef int32_t OSTick;
28 typedef int64_t OSTime;
29 
30 typedef struct
31 {
32  int32_t tm_sec;
33  int32_t tm_min;
34  int32_t tm_hour;
35  int32_t tm_mday;
36  int32_t tm_mon;
37  int32_t tm_year;
39 
40 OSTime OSGetTime();
41 OSTime OSGetSystemTime();
42 OSTick OSGetTick();
43 OSTick OSGetSystemTick();
44 OSTime OSCalendarTimeToTicks(OSCalendarTime *calendarTime);
45 void OSTicksToCalendarTime(OSTime time, OSCalendarTime *calendarTime);
46 
47 #ifdef __cplusplus
48 }
49 #endif
Definition: time.h:30