[WiiU] Fix indentation, for real this time

-_-
This commit is contained in:
Ash 2018-01-30 17:43:45 +11:00
parent 68f7aeadb2
commit af37d3780a
No known key found for this signature in database
GPG Key ID: F8C85A8C836C0A7E
1 changed files with 26 additions and 26 deletions

View File

@ -56,35 +56,35 @@ struct passwd* getpwuid(uid_t uid) {
/* Basic Cafe OS clock thingy. */ /* Basic Cafe OS clock thingy. */
int _gettimeofday_r(struct _reent *ptr, int _gettimeofday_r(struct _reent *ptr,
struct timeval* ptimeval, struct timeval* ptimeval,
void* ptimezone) { void* ptimezone) {
OSTime cosTime; OSTime cosTime;
uint64_t cosSecs; uint64_t cosSecs;
uint32_t cosUSecs; uint32_t cosUSecs;
time_t unixSecs; time_t unixSecs;
/* We need somewhere to put our output */ /* We need somewhere to put our output */
if (ptimeval == NULL) { if (ptimeval == NULL) {
errno = EFAULT; errno = EFAULT;
return -1; return -1;
} }
/* Get Cafe OS clock in seconds; epoch 2000-01-01 00:00 */ /* Get Cafe OS clock in seconds; epoch 2000-01-01 00:00 */
cosTime = OSGetTime(); cosTime = OSGetTime();
cosSecs = ticks_to_sec(cosTime); cosSecs = ticks_to_sec(cosTime);
/* Get extra milliseconds */ /* Get extra milliseconds */
cosUSecs = ticks_to_us(cosTime) - (cosSecs * 1000000); cosUSecs = ticks_to_us(cosTime) - (cosSecs * 1000000);
/* Convert to Unix time, epoch 1970-01-01 00:00. /* Convert to Unix time, epoch 1970-01-01 00:00.
Constant value is seconds between 1970 and 2000. Constant value is seconds between 1970 and 2000.
time_t is 32bit here, so the Wii U is vulnerable to the 2038 problem. */ time_t is 32bit here, so the Wii U is vulnerable to the 2038 problem. */
unixSecs = cosSecs + 946684800; unixSecs = cosSecs + 946684800;
ptimeval->tv_sec = unixSecs; ptimeval->tv_sec = unixSecs;
ptimeval->tv_usec = cosUSecs; ptimeval->tv_usec = cosUSecs;
return 0; return 0;
} }
/* POSIX clock in all its glory */ /* POSIX clock in all its glory */
@ -100,16 +100,16 @@ int clock_gettime(clockid_t clk_id, struct timespec* tp) {
switch (clk_id) { switch (clk_id) {
case CLOCK_REALTIME: case CLOCK_REALTIME:
/* Just wrap gettimeofday. Cheating, I know. */ /* Just wrap gettimeofday. Cheating, I know. */
ret = _gettimeofday_r(NULL, &ptimeval, NULL); ret = _gettimeofday_r(NULL, &ptimeval, NULL);
if (ret) return -1; if (ret) return -1;
tp->tv_sec = ptimeval.tv_sec; tp->tv_sec = ptimeval.tv_sec;
tp->tv_nsec = ptimeval.tv_usec * 1000; tp->tv_nsec = ptimeval.tv_usec * 1000;
break; break;
default: default:
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
return 0; return 0;
} }