diff options
Diffstat (limited to 'tipper/translations.cpp')
-rw-r--r-- | tipper/translations.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tipper/translations.cpp b/tipper/translations.cpp index 17ce9b1..7dcc1fe 100644 --- a/tipper/translations.cpp +++ b/tipper/translations.cpp @@ -550,6 +550,31 @@ TCHAR *empty_xStatus_name_to_default_name(HANDLE hContact, const char *module_na return buff;
} +TCHAR *timezone_to_time(HANDLE hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) { + int timezone = DBGetContactSettingByte(hContact,module_name,setting_name,256);
+ if(timezone==256 || (char)timezone==-100) {
+ return 0;
+ }
+
+ TIME_ZONE_INFORMATION tzi;
+ FILETIME ft;
+ LARGE_INTEGER lift;
+ SYSTEMTIME st;
+
+ timezone=(char)timezone;
+ GetSystemTimeAsFileTime(&ft);
+ if(GetTimeZoneInformation(&tzi) == TIME_ZONE_ID_DAYLIGHT)
+ timezone += tzi.DaylightBias / 30;
+
+ lift.QuadPart = *(__int64*)&ft;
+ lift.QuadPart -= (__int64)timezone * BIGI(30) * BIGI(60) * BIGI(10000000);
+ *(__int64*)&ft = lift.QuadPart;
+ FileTimeToSystemTime(&ft, &st);
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, buff, bufflen);
+
+ return buff; +} + int ServiceAddTranslation(WPARAM wParam, LPARAM lParam) { if(!lParam) return 1; @@ -562,7 +587,7 @@ int ServiceAddTranslation(WPARAM wParam, LPARAM lParam) { void InitTranslations() { next_func_id = DBGetContactSettingDword(0, MODULE, "NextFuncId", 1); -#define INT_TRANS_COUNT 18 +#define INT_TRANS_COUNT 19 DBVTranslation internal_translations[INT_TRANS_COUNT] = { { (TranslateFunc*)null_translation, @@ -635,6 +660,10 @@ void InitTranslations() { { (TranslateFunc*)seconds_to_time_difference, _T("DWORD seconds to time difference") + }, + { + (TranslateFunc*)timezone_to_time, + _T("BYTE timezone to time") } }; |