wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
time.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
3#include "systeminfo.h"
4
11#ifdef __cplusplus
12extern "C" {
13#endif
14
16
17typedef int32_t OSTick;
18typedef int64_t OSTime;
19
22{
24 int32_t tm_sec;
26 int32_t tm_min;
28 int32_t tm_hour;
30 int32_t tm_mday;
32 int32_t tm_mon;
34 int32_t tm_year;
36 int32_t tm_wday;
38 int32_t tm_yday;
40 int32_t tm_msec;
42 int32_t tm_usec;
43};
44WUT_CHECK_OFFSET(OSCalendarTime, 0x00, tm_sec);
45WUT_CHECK_OFFSET(OSCalendarTime, 0x04, tm_min);
46WUT_CHECK_OFFSET(OSCalendarTime, 0x08, tm_hour);
47WUT_CHECK_OFFSET(OSCalendarTime, 0x0C, tm_mday);
48WUT_CHECK_OFFSET(OSCalendarTime, 0x10, tm_mon);
49WUT_CHECK_OFFSET(OSCalendarTime, 0x14, tm_year);
50WUT_CHECK_OFFSET(OSCalendarTime, 0x18, tm_wday);
51WUT_CHECK_OFFSET(OSCalendarTime, 0x1C, tm_yday);
52WUT_CHECK_OFFSET(OSCalendarTime, 0x20, tm_msec);
53WUT_CHECK_OFFSET(OSCalendarTime, 0x24, tm_usec);
54WUT_CHECK_SIZE(OSCalendarTime, 0x28);
55
56#define OSTimerClockSpeed ((OSGetSystemInfo()->busClockSpeed) / 4)
57
58#define OSSecondsToTicks(val) ((uint64_t)(val) * (uint64_t)OSTimerClockSpeed)
59#define OSMillisecondsToTicks(val) (((uint64_t)(val) * (uint64_t)OSTimerClockSpeed) / 1000ull)
60#define OSMicrosecondsToTicks(val) (((uint64_t)(val) * (uint64_t)OSTimerClockSpeed) / 1000000ull)
61#define OSNanosecondsToTicks(val) (((uint64_t)(val) * ((uint64_t)OSTimerClockSpeed) / 31250ull) / 32000ull)
62
63#define OSTicksToSeconds(val) ((uint64_t)(val) / (uint64_t)OSTimerClockSpeed)
64#define OSTicksToMilliseconds(val) (((uint64_t)(val) * 1000ull) / (uint64_t)OSTimerClockSpeed)
65#define OSTicksToMicroseconds(val) (((uint64_t)(val) * 1000000ull) / (uint64_t)OSTimerClockSpeed)
66#define OSTicksToNanoseconds(val) (((uint64_t)(val) * 32000ull) / ((uint64_t)OSTimerClockSpeed / 31250ull))
67
70
73
76
79
82
83void
85 OSCalendarTime *calendarTime);
86
87BOOL
89
90#ifdef __cplusplus
91}
92#endif
93
int32_t tm_hour
Hours since midnight. The range is 0-23.
Definition time.h:28
int32_t tm_sec
Seconds after the minute. The range is 0-59.
Definition time.h:24
int32_t tm_wday
Days since Sunday. The range is 0-6.
Definition time.h:36
int32_t tm_yday
Days since January 1. The range is 0-365.
Definition time.h:38
int32_t tm_mday
Day of the month. The range is 1-31.
Definition time.h:30
int32_t tm_mon
Month since January. The range is 0-11.
Definition time.h:32
int32_t tm_usec
Microseconds after the millisecond. The range is 0-999.
Definition time.h:42
int32_t tm_year
Years in AD. The range is 1-....
Definition time.h:34
int32_t tm_msec
Milliseconds after the second. The range is 0-999.
Definition time.h:40
int32_t tm_min
Minutes after the hour. The range is 0-59.
Definition time.h:26
OSTick OSGetSystemTick()
OSTime OSCalendarTimeToTicks(OSCalendarTime *calendarTime)
int64_t OSTime
Definition time.h:18
int32_t OSTick
Definition time.h:17
OSTime OSGetSystemTime()
void OSTicksToCalendarTime(OSTime time, OSCalendarTime *calendarTime)
OSTime OSGetTime()
OSTick OSGetTick()
BOOL __OSSetAbsoluteSystemTime(OSTime time)
Same as std c struct tm but with msec and usec added.
Definition time.h:22
int32_t BOOL
Definition wut_types.h:7