all repos — mgba @ b4c86ea161856a61117e3712d00307f6b5cd15e5

mGBA Game Boy Advance Emulator

PSP2: Use sceKernelLibcLocaltime_r instead of faking it
Jeffrey Pfau jeffrey@endrift.com
Tue, 22 Sep 2015 21:15:13 -0700
commit

b4c86ea161856a61117e3712d00307f6b5cd15e5

parent

bb2b82d15e66bf05ba209f6097f26d756be0605b

2 files changed, 2 insertions(+), 19 deletions(-)

jump to
M src/platform/psp2/CMakeLists.txtsrc/platform/psp2/CMakeLists.txt

@@ -11,7 +11,7 @@

list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sce-vfs.c) set(VFS_SRC ${VFS_SRC} PARENT_SCOPE) -set(OS_LIB -lvita2d -lSceCtrl_stub -lSceRtc_stub -lSceGxm_stub -lSceDisplay_stub -lSceAudio_stub -lSceMotion_stub -lScePower_stub -lSceTouch_stub -lSceCommonDialog_stub -lpng -lz -l${M_LIBRARY}) +set(OS_LIB -lvita2d -lSceCtrl_stub -lSceGxm_stub -lSceDisplay_stub -lSceAudio_stub -lSceMotion_stub -lScePower_stub -lSceTouch_stub -lSceCommonDialog_stub -lpng -lz -l${M_LIBRARY}) set(OBJCOPY_CMD ${OBJCOPY} -I binary -O elf32-littlearm -B arm) list(APPEND GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gui-font.c)
M src/util/formatting.csrc/util/formatting.c

@@ -73,29 +73,12 @@ return res;

} #ifndef HAVE_LOCALTIME_R -#ifdef PSP2 -#include <psp2/rtc.h> -#endif - struct tm* localtime_r(const time_t* t, struct tm* date) { #ifdef _WIN32 localtime_s(date, t); return date; #elif defined(PSP2) - SceRtcTime sceRtc; - uint64_t tick, localtick; - sceRtcSetTime_t(&sceRtc, *t); - sceRtcGetTick(&sceRtc, &tick); - sceRtcConvertUtcToLocalTime(&tick, &localtick); - sceRtcSetTick(&sceRtc, &localtick); - date->tm_year = sceRtc.year; - date->tm_mon = sceRtc.month; - date->tm_mday = sceRtc.day; - date->tm_hour = sceRtc.hour; - date->tm_min = sceRtc.minutes; - date->tm_sec = sceRtc.seconds; - date->tm_wday = sceRtcGetDayOfWeek(sceRtc.year, sceRtc.month, sceRtc.day); - return date; + return sceKernelLibcLocaltime_r(t, date); #else #warning localtime_r not emulated on this platform return 0;