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 private: 38 status_t _FillTmValues(const TimeZone* icuTimeZone, 39 const time_t* inTime, struct tm* tmOut); 40 41 const ICUTimeData& fTimeData; 42 43 TimeConversionDataBridge* fDataBridge; 44 45 TimeZone* fTimeZone; 46 char fTimeZoneID[B_FILE_NAME_LENGTH]; 47 }; 48 49 50 } // namespace Libroot 51 } // namespace BPrivate 52 53 54 #endif // _ICU_TIME_BACKEND_H 55