aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2014-11-10 09:20:22 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-10 09:20:22 -0800
commit8e74b1565c5573a0be40060cebbc112fc156f26d (patch)
tree000c2fc04406d633886696b886ef8088ab2c974d /src
parent7c74885e017a2473383fed72bd629cc07c773942 (diff)
Fix SkTime::GetDateTime Posix implementation, add unit test.
The year was off by 1900 Review URL: https://codereview.chromium.org/714633002
Diffstat (limited to 'src')
-rw-r--r--src/ports/SkTime_Unix.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ports/SkTime_Unix.cpp b/src/ports/SkTime_Unix.cpp
index f519a69d07..6e305a16f6 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);