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

Unified Diff: src/ports/SkTime_Unix.cpp

Issue 714633002: Fix SkTime::GetDateTime Posix implementation, add unit test. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: limit the year check in the test to the next 50 years Created 6 years, 1 month 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 | « gyp/tests.gypi ('k') | tests/Time.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 f519a69d07c2843a60427ea385a5d79b11dd765c..6e305a16f6eb8073e393e1d5d8629826035daaab 100644
--- a/src/ports/SkTime_Unix.cpp
+++ b/src/ports/SkTime_Unix.cpp
@@ -20,8 +20,8 @@ void SkTime::GetDateTime(DateTime* dt)
time(&m_time);
struct tm* tstruct;
tstruct = localtime(&m_time);
-
- dt->fYear = tstruct->tm_year;
+ // http://pubs.opengroup.org/onlinepubs/009695399/basedefs/time.h.html
+ 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);
« no previous file with comments | « gyp/tests.gypi ('k') | tests/Time.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698