diff options
author | Mike Lockwood <lockwood@android.com> | 2011-01-26 15:34:15 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-01-26 15:34:15 -0800 |
commit | d7376cae7aba269dca143b94c3d6736d0ed02213 (patch) | |
tree | 9c658125af8046049b62e6608f990d31e0b0cf2d /media/mtp | |
parent | 76fd218ca290ffbb33790ae525c494d339da9d28 (diff) | |
parent | 84d3a304c835017cdc530eb9d8e92198021d3e4c (diff) | |
download | frameworks_av-d7376cae7aba269dca143b94c3d6736d0ed02213.zip frameworks_av-d7376cae7aba269dca143b94c3d6736d0ed02213.tar.gz frameworks_av-d7376cae7aba269dca143b94c3d6736d0ed02213.tar.bz2 |
am bd65c065: am a13732e1: Merge "MTP: Fix month off by one error in date parsing and formatting code" into honeycomb
* commit 'bd65c065b2dcb54dde563a8a21c9f92da947c7dd':
MTP: Fix month off by one error in date parsing and formatting code
Diffstat (limited to 'media/mtp')
-rw-r--r-- | media/mtp/MtpUtils.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/media/mtp/MtpUtils.cpp b/media/mtp/MtpUtils.cpp index ab01ef5..6ec8876 100644 --- a/media/mtp/MtpUtils.cpp +++ b/media/mtp/MtpUtils.cpp @@ -55,7 +55,7 @@ bool parseDateTime(const char* dateTime, time_t& outSeconds) { tm.tm_min = minute; tm.tm_hour = hour; tm.tm_mday = day; - tm.tm_mon = month; + tm.tm_mon = month - 1; // mktime uses months in 0 - 11 range tm.tm_year = year - 1900; tm.tm_wday = 0; tm.tm_isdst = -1; @@ -72,7 +72,9 @@ void formatDateTime(time_t seconds, char* buffer, int bufferLength) { localtime_r(&seconds, &tm); snprintf(buffer, bufferLength, "%04d%02d%02dT%02d%02d%02d", - tm.tm_year + 1900, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); + tm.tm_year + 1900, + tm.tm_mon + 1, // localtime_r uses months in 0 - 11 range + tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); } } // namespace android |