summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_timezones.h12
-rw-r--r--plugins/UserInfoEx/src/ctrl_tzcombo.cpp10
-rw-r--r--src/mir_core/src/Windows/timezones.cpp5
3 files changed, 14 insertions, 13 deletions
diff --git a/include/m_timezones.h b/include/m_timezones.h
index 4f4d49ca2b..5fc78c41d0 100644
--- a/include/m_timezones.h
+++ b/include/m_timezones.h
@@ -77,20 +77,20 @@ __forceinline int printTimeStampByContact(MCONTACT hContact, mir_time ts, LPCTST
}
#ifdef _MSC_VER
-__forceinline LPTIME_ZONE_INFORMATION getTziByContact(MCONTACT hContact)
+__forceinline LPTIME_ZONE_INFORMATION getTziByContact(MCONTACT hContact, uint32_t dwFlags = 0)
{
- return TimeZone_GetInfo(TimeZone_CreateByContact(hContact, nullptr, 0));
+ return TimeZone_GetInfo(TimeZone_CreateByContact(hContact, nullptr, dwFlags));
}
-__forceinline int getTimeZoneTimeByContact(MCONTACT hContact, SYSTEMTIME *st)
+__forceinline int getTimeZoneTimeByContact(MCONTACT hContact, SYSTEMTIME *st, uint32_t dwFlags = 0)
{
- return TimeZone_GetTimeZoneTime(TimeZone_CreateByContact(hContact, nullptr, 0), st);
+ return TimeZone_GetTimeZoneTime(TimeZone_CreateByContact(hContact, nullptr, dwFlags), st);
}
#endif
-__forceinline mir_time timeStampToTimeZoneTimeStampByContact(MCONTACT hContact, mir_time ts)
+__forceinline mir_time timeStampToTimeZoneTimeStampByContact(MCONTACT hContact, mir_time ts, uint32_t dwFlags = 0)
{
- return TimeZone_UtcToLocal(TimeZone_CreateByContact(hContact, nullptr, 0), ts);
+ return TimeZone_UtcToLocal(TimeZone_CreateByContact(hContact, nullptr, dwFlags), ts);
}
#endif
diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp
index f28c7812a0..dd6c8d8d49 100644
--- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp
+++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp
@@ -75,12 +75,12 @@ CTzCombo::CTzCombo(HWND hDlg, uint16_t idCtrl, LPCSTR pszSetting)
**/
int CTzCombo::Find(LPTIME_ZONE_INFORMATION pTimeZone) const
{
- int nItemIndex;
int nItemCount = ComboBox_GetCount(_hwnd);
- for (nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++) {
- if (pTimeZone == TimeZone_GetInfo((HANDLE)ComboBox_GetItemData(_hwnd, nItemIndex)))
- return nItemIndex;
+ for (int i = 0; i < nItemCount; i++) {
+ HANDLE pItemData = (HANDLE)ComboBox_GetItemData(_hwnd, i);
+ if (pItemData && pTimeZone == TimeZone_GetInfo(pItemData))
+ return i;
}
return CB_ERR;
}
@@ -110,7 +110,7 @@ BOOL CTzCombo::OnInfoChanged(MCONTACT hContact, LPCSTR)
{
if (!_Flags.B.hasChanged) {
LPTIME_ZONE_INFORMATION pTimeZone;
- pTimeZone = getTziByContact(hContact);
+ pTimeZone = getTziByContact(hContact, TZF_PLF_CB);
ComboBox_SetCurSel(_hwnd, Find(pTimeZone));
_curSel = ComboBox_GetCurSel(_hwnd);
SendMessage(GetParent(_hwnd), WM_TIMER, 0, 0);
diff --git a/src/mir_core/src/Windows/timezones.cpp b/src/mir_core/src/Windows/timezones.cpp
index 414e59ff91..63d026a3eb 100644
--- a/src/mir_core/src/Windows/timezones.cpp
+++ b/src/mir_core/src/Windows/timezones.cpp
@@ -216,8 +216,9 @@ MIR_CORE_DLL(HANDLE) TimeZone_CreateByName(LPCTSTR tszName, uint32_t dwFlags)
if (tszName == nullptr)
return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? nullptr : &myInfo.myTZ;
- if (mir_wstrcmp(myInfo.myTZ.tszName, tszName) == 0)
- return (dwFlags & TZF_DIFONLY) ? nullptr : &myInfo.myTZ;
+ if (!(dwFlags & TZF_PLF_CB))
+ if (mir_wstrcmp(myInfo.myTZ.tszName, tszName) == 0)
+ return (dwFlags & TZF_DIFONLY) ? nullptr : &myInfo.myTZ;
MIM_TIMEZONE tzsearch;
tzsearch.hash = mir_hashstrT(tszName);