X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fio%2FFIo_FileUtil.cpp;h=439b81b0db2dd8714009710fa80f930268021065;hb=HEAD;hp=fd426c343b3d7f50327aa20f30d9801af2d716b4;hpb=3aedbf35592d9c77c462b2643adaae02f0e6d89c;p=platform%2Fframework%2Fnative%2Fappfw.git diff --git a/src/io/FIo_FileUtil.cpp b/src/io/FIo_FileUtil.cpp index fd426c3..439b81b 100644 --- a/src/io/FIo_FileUtil.cpp +++ b/src/io/FIo_FileUtil.cpp @@ -36,6 +36,8 @@ #include #include #include +#include +#include #include #include @@ -47,6 +49,7 @@ using namespace std; using namespace Tizen::Base; +using namespace Tizen::Locales; using namespace Tizen::App; namespace Tizen { namespace Io @@ -54,7 +57,6 @@ namespace Tizen { namespace Io static const int _BASE_YEAR = 1900; static const int _MAX_COPY_BYTES = 4096; -static const int _MAX_OPENMODE_LENGTH = 3; //Holds app path prefixes static const char* filePathAppPrefix[] = @@ -345,14 +347,21 @@ _FileUtil::GetAttributes(const String& filePath, FileAttributes& attribute) attr = statbuf.st_mode; struct tm resultTm; - struct tm* pTm = localtime_r(&statbuf.st_mtime, &resultTm); + struct tm* pTm = gmtime_r(&statbuf.st_mtime, &resultTm); SysTryReturnResult(NID_IO, pTm != null, E_SYSTEM, "Failed to get local time (%s).", strerror(errno)); r = dateTime.SetValue(_BASE_YEAR + pTm->tm_year, 1 + pTm->tm_mon, pTm->tm_mday, pTm->tm_hour, pTm->tm_min, pTm->tm_sec); - SysTryReturn(NID_IO, (!IsFailed(r)), r, r, "[%s] Failed to set DateTime.", GetErrorMessage(r)); + SysTryReturn(NID_IO, !IsFailed(r), E_SYSTEM, r, "[%s] Failed to set DateTime.", GetErrorMessage(r)); r = modifiedTime.SetValue(_BASE_YEAR + pTm->tm_year, 1 + pTm->tm_mon, pTm->tm_mday, pTm->tm_hour, pTm->tm_min, pTm->tm_sec); - SysTryReturn(NID_IO, (!IsFailed(r)), r, r, "[%s] Failed to set DateTime.", GetErrorMessage(r)); + SysTryReturn(NID_IO, !IsFailed(r), E_SYSTEM, r, "[%s] Failed to set DateTime.", GetErrorMessage(r)); + + LocaleManager locMgr; + locMgr.Construct(); + + TimeZone tmZone = locMgr.GetSystemTimeZone(); + DateTime locDateTime = tmZone.UtcTimeToWallTime(dateTime); + DateTime locModifiedTime = tmZone.UtcTimeToWallTime(modifiedTime); fileName = _FileUtil::GetFileName(filePath); if (fileName.StartsWith(L".", 0)) // including . and .. @@ -360,7 +369,7 @@ _FileUtil::GetAttributes(const String& filePath, FileAttributes& attribute) hidden = true; } - _FileAttributesImpl::GetInstance(attribute)->Set(dateTime, modifiedTime, fileSize, attr, hidden); + _FileAttributesImpl::GetInstance(attribute)->Set(locDateTime, locModifiedTime, fileSize, attr, hidden); return E_SUCCESS; }