use the timezone value for non GLIB, non MSVC platforms

This commit is contained in:
Peter Tissen 2015-03-06 21:49:04 +01:00
parent f5795a68a7
commit 594ed65bd3

View File

@ -459,12 +459,16 @@ static int sceRtcConvertLocalTimeToUTC(u32 tickLocalPtr,u32 tickUTCPtr)
{
u64 srcTick = Memory::Read_U64(tickLocalPtr);
// TODO : Let the user select his timezone / daylight saving instead of taking system param ?
#if !defined(_MSC_VER)
#if defined(__GLIBC__) || defined(BLACKBERRY) || defined(__SYMBIAN32__)
time_t timezone = 0;
tm *time = localtime(&timezone);
srcTick -= time->tm_gmtoff*1000000ULL;
#elif defined(_MSC_VER)
long timezone_val;
_get_timezone(&timezone_val);
srcTick -= -timezone_val * 1000000ULL;
#else
srcTick -= -_timezone * 1000000ULL;
srcTick -= -timezone * 1000000ULL;
#endif
Memory::Write_U64(srcTick, tickUTCPtr);
}
@ -482,12 +486,16 @@ static int sceRtcConvertUtcToLocalTime(u32 tickUTCPtr,u32 tickLocalPtr)
{
u64 srcTick = Memory::Read_U64(tickUTCPtr);
// TODO : Let the user select his timezone / daylight saving instead of taking system param ?
#if !defined(_MSC_VER)
#if defined(__GLIBC__) || defined(BLACKBERRY) || defined(__SYMBIAN32__)
time_t timezone = 0;
tm *time = localtime(&timezone);
srcTick += time->tm_gmtoff*1000000ULL;
#elif defined(_MSC_VER)
long timezone_val;
_get_timezone(&timezone_val);
srcTick += -timezone_val * 1000000ULL;
#else
srcTick += -_timezone * 1000000ULL;
srcTick += -timezone * 1000000ULL;
#endif
Memory::Write_U64(srcTick, tickLocalPtr);
}
@ -1015,12 +1023,16 @@ static int sceRtcFormatRFC2822LocalTime(u32 outPtr, u32 srcTickPtr)
}
int tz_seconds;
#if !defined(_MSC_VER)
#if defined(__GLIBC__) || defined(BLACKBERRY) || defined(__SYMBIAN32__)
time_t timezone = 0;
tm *time = localtime(&timezone);
tz_seconds = time->tm_gmtoff;
#elif defined(_MSC_VER)
long timezone_val;
_get_timezone(&timezone_val);
tz_seconds = -timezone_val;
#else
tz_seconds = -_timezone;
tz_seconds = -timezone;
#endif
DEBUG_LOG(SCERTC, "sceRtcFormatRFC2822LocalTime(%08x, %08x)", outPtr, srcTickPtr);
@ -1050,12 +1062,16 @@ static int sceRtcFormatRFC3339LocalTime(u32 outPtr, u32 srcTickPtr)
}
int tz_seconds;
#if !defined(_MSC_VER)
#if defined(__GLIBC__) || defined(BLACKBERRY) || defined(__SYMBIAN32__)
time_t timezone = 0;
tm *time = localtime(&timezone);
tz_seconds = time->tm_gmtoff;
#elif defined(_MSC_VER)
long timezone_val;
_get_timezone(&timezone_val);
tz_seconds = -timezone_val;
#else
tz_seconds = -_timezone;
tz_seconds = -timezone;
#endif
DEBUG_LOG(SCERTC, "sceRtcFormatRFC3339LocalTime(%08x, %08x)", outPtr, srcTickPtr);