s/C++'s gmtime/POSIX's gmtime_r/

BUG=skia:5923

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4341

Change-Id: I258da9bfa98f16e1abdea0f18ae786f9df118a8e
Reviewed-on: https://skia-review.googlesource.com/4341
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
Hal Canary 2016-11-02 12:37:56 -04:00 committed by Skia Commit-Bot
parent e76071ca0f
commit 2f04712810

View File

@ -50,16 +50,16 @@ void SkTime::GetDateTime(DateTime* dt) {
if (dt) {
time_t m_time;
time(&m_time);
struct tm* tstruct;
tstruct = gmtime(&m_time);
struct tm tstruct;
gmtime_r(&m_time, &tstruct);
dt->fTimeZoneMinutes = 0;
dt->fYear = tstruct->tm_year + 1900;
dt->fMonth = SkToU8(tstruct->tm_mon + 1);
dt->fDayOfWeek = SkToU8(tstruct->tm_wday);
dt->fDay = SkToU8(tstruct->tm_mday);
dt->fHour = SkToU8(tstruct->tm_hour);
dt->fMinute = SkToU8(tstruct->tm_min);
dt->fSecond = SkToU8(tstruct->tm_sec);
dt->fYear = tstruct.tm_year + 1900;
dt->fMonth = SkToU8(tstruct.tm_mon + 1);
dt->fDayOfWeek = SkToU8(tstruct.tm_wday);
dt->fDay = SkToU8(tstruct.tm_mday);
dt->fHour = SkToU8(tstruct.tm_hour);
dt->fMinute = SkToU8(tstruct.tm_min);
dt->fSecond = SkToU8(tstruct.tm_sec);
}
}
#endif // SK_BUILD_FOR_WIN32