Skip to content

Commit

Permalink
use the timezone value for non GLIB, non MSVC platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Bigpet committed Mar 6, 2015
1 parent f5795a6 commit 594ed65
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions Core/HLE/sceRtc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 594ed65

Please sign in to comment.