1 /* 2 * Copyright 2010-2011, Oliver Tappe, zooey@hirschkaefer.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _ICU_TIME_CONVERSION_H 6 #define _ICU_TIME_CONVERSION_H 7 8 9 #include <time.h> 10 11 #include <StorageDefs.h> 12 13 #include "ICUTimeData.h" 14 #include "LocaleBackend.h" 15 16 17 namespace BPrivate { 18 namespace Libroot { 19 20 21 class ICUTimeConversion { 22 public: 23 ICUTimeConversion(const ICUTimeData& timeData); 24 virtual ~ICUTimeConversion(); 25 26 virtual void Initialize( 27 TimeConversionDataBridge* dataBridge); 28 29 status_t TZSet(const char* timeZoneID, const char* tz); 30 31 status_t Localtime(const time_t* inTime, 32 struct tm* tmOut); 33 status_t Gmtime(const time_t* inTime, struct tm* tmOut); 34 35 status_t Mktime(struct tm* inOutTm, time_t& timeOut); 36 37 status_t Timegm(struct tm* inOutTm, time_t& timeOut); 38 39 private: 40 status_t _FillTmValues(const U_NAMESPACE_QUALIFIER 41 TimeZone* icuTimeZone, 42 const time_t* inTime, struct tm* tmOut); 43 44 status_t _Mktime(const U_NAMESPACE_QUALIFIER 45 TimeZone* icuTimeZone, 46 struct tm* inOutTm, time_t& timeOut); 47 48 const ICUTimeData& fTimeData; 49 50 TimeConversionDataBridge* fDataBridge; 51 52 U_NAMESPACE_QUALIFIER TimeZone* fTimeZone; 53 char fTimeZoneID[B_FILE_NAME_LENGTH]; 54 }; 55 56 57 } // namespace Libroot 58 } // namespace BPrivate 59 60 61 #endif // _ICU_TIME_BACKEND_H 62