2018-05-28 11:40:22 +01:00
|
|
|
#include "wut_newlib.h"
|
2021-02-09 17:23:10 +01:00
|
|
|
#include "wut_clock.h"
|
2018-05-28 11:40:22 +01:00
|
|
|
|
|
|
|
#include <coreinit/time.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
__wut_gettod_r(struct _reent *ptr,
|
|
|
|
struct timeval *tp,
|
|
|
|
struct timezone *tz)
|
|
|
|
{
|
2021-02-09 17:23:10 +01:00
|
|
|
OSTime time = OSGetTime();
|
2018-05-28 11:40:22 +01:00
|
|
|
|
|
|
|
if (tp != NULL) {
|
2021-02-09 17:23:10 +01:00
|
|
|
tp->tv_sec = (time_t)OSTicksToSeconds(time);
|
|
|
|
|
|
|
|
time -= OSSecondsToTicks(tp->tv_sec);
|
|
|
|
tp->tv_usec = (long)OSTicksToMicroseconds(time);
|
|
|
|
|
|
|
|
tp->tv_sec += EPOCH_DIFF_SECS;
|
2018-05-28 11:40:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tz != NULL) {
|
|
|
|
tz->tz_minuteswest = 0;
|
|
|
|
tz->tz_dsttime = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|