RetroArch
time.h
Go to the documentation of this file.
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 {
39 
40 
46 void OSTicksToCalendarTime(OSTime time, OSCalendarTime *calendarTime);
47 
48 #ifdef __cplusplus
49 }
50 #endif
void OSTicksToCalendarTime(OSTime time, OSCalendarTime *calendarTime)
OSTime OSCalendarTimeToTicks(OSCalendarTime *calendarTime)
int32_t tm_mon
Definition: time.h:36
OSTick OSGetTick()
Definition: time.h:30
int32_t tm_hour
Definition: time.h:34
int32_t tm_sec
Definition: time.h:32
OSTime OSGetSystemTime()
time_t time(time_t *timer)
int64_t OSTime
Definition: time.h:28
signed int int32_t
Definition: stdint.h:123
int32_t OSTick
Definition: time.h:27
OSTick OSGetSystemTick()
int32_t tm_mday
Definition: time.h:35
int32_t tm_year
Definition: time.h:37
signed __int64 int64_t
Definition: stdint.h:135
int32_t tm_min
Definition: time.h:33
OSTime OSGetTime()