Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: src/ports/SkTime_Unix.cpp

Issue 1109593002: SkTime: return timezone information (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: reorder assignment Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkTime.cpp ('k') | src/ports/SkTime_win.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkTime_Unix.cpp
diff --git a/src/ports/SkTime_Unix.cpp b/src/ports/SkTime_Unix.cpp
index 6e305a16f6eb8073e393e1d5d8629826035daaab..2d5fa279b468152cdbd8249764e0a6c29c73fd1f 100644
--- a/src/ports/SkTime_Unix.cpp
+++ b/src/ports/SkTime_Unix.cpp
@@ -16,11 +16,15 @@ void SkTime::GetDateTime(DateTime* dt)
{
if (dt)
{
+ tzset(); // initialize timezone variable;
time_t m_time;
time(&m_time);
struct tm* tstruct;
tstruct = localtime(&m_time);
+ int offset = tstruct->tm_isdst == 1 ? 60 : 0;
+
// http://pubs.opengroup.org/onlinepubs/009695399/basedefs/time.h.html
+ dt->fTimeZoneMinutes = SkToS16(offset - timezone / 60);
dt->fYear = tstruct->tm_year + 1900;
dt->fMonth = SkToU8(tstruct->tm_mon + 1);
dt->fDayOfWeek = SkToU8(tstruct->tm_wday);
« no previous file with comments | « src/core/SkTime.cpp ('k') | src/ports/SkTime_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698