summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_timezones.h10
-rw-r--r--src/modules/utils/timeutils.cpp6
-rw-r--r--src/modules/utils/timezones.cpp18
3 files changed, 18 insertions, 16 deletions
diff --git a/include/m_timezones.h b/include/m_timezones.h
index 39681cef1c..cf8fda340b 100644
--- a/include/m_timezones.h
+++ b/include/m_timezones.h
@@ -33,6 +33,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define LOCAL_TIME_HANDLE NULL
#define UTC_TIME_HANDLE ((void*)-1)
+typedef INT_PTR mir_time;
+
typedef struct
{
size_t cbSize;
@@ -42,14 +44,14 @@ typedef struct
void (*storeByContact)(HANDLE hContact, HANDLE hTZ);
int (*printDateTime)(HANDLE hTZ, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags);
- int (*printTimeStamp)(HANDLE hTZ, time_t ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags);
+ int (*printTimeStamp)(HANDLE hTZ, mir_time ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags);
int (*prepareList)(HANDLE hContact, HWND hWnd, DWORD dwFlags);
int (*selectListItem)(HANDLE hContact, HWND hWnd, DWORD dwFlags);
void (*storeListResults)(HANDLE hContact, HWND hWnd, DWORD dwFlags);
int (*getTimeZoneTime)(HANDLE hTZ, SYSTEMTIME *st);
- time_t (*timeStampToTimeZoneTimeStamp)(HANDLE hTZ, time_t ts);
+ mir_time (*timeStampToTimeZoneTimeStamp)(HANDLE hTZ, mir_time ts);
LPTIME_ZONE_INFORMATION (*getTzi)(HANDLE hTZ);
LPCTSTR (*getTzName)(HANDLE hTZ);
@@ -58,7 +60,7 @@ typedef struct
int printDateTimeByContact (HANDLE hContact, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags)
{ return printDateTime(createByContact(hContact, dwFlags), szFormat, szDest, cbDest, dwFlags); }
- int printTimeStampByContact(HANDLE hContact, time_t ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags)
+ int printTimeStampByContact(HANDLE hContact, mir_time ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags)
{ return printTimeStamp(createByContact(hContact, dwFlags), ts, szFormat, szDest, cbDest, dwFlags); }
LPTIME_ZONE_INFORMATION getTziByContact(HANDLE hContact)
@@ -67,7 +69,7 @@ typedef struct
int getTimeZoneTimeByContact(HANDLE hContact, SYSTEMTIME *st)
{ return getTimeZoneTime(createByContact(hContact, 0), st); }
- time_t timeStampToTimeZoneTimeStampByContact(HANDLE hContact, time_t ts)
+ mir_time timeStampToTimeZoneTimeStampByContact(HANDLE hContact, mir_time ts)
{ return timeStampToTimeZoneTimeStamp(createByContact(hContact, 0), ts); }
#endif
diff --git a/src/modules/utils/timeutils.cpp b/src/modules/utils/timeutils.cpp
index 205457e76d..8df679d359 100644
--- a/src/modules/utils/timeutils.cpp
+++ b/src/modules/utils/timeutils.cpp
@@ -26,18 +26,18 @@ simple UTC offsets.
#include "..\..\core\commonheaders.h"
//KB167296
-void UnixTimeToFileTime(time_t ts, LPFILETIME pft)
+void UnixTimeToFileTime(mir_time ts, LPFILETIME pft)
{
unsigned __int64 ll = UInt32x32To64(ts, 10000000) + 116444736000000000i64;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
}
-time_t FileTimeToUnixTime(LPFILETIME pft)
+mir_time FileTimeToUnixTime(LPFILETIME pft)
{
unsigned __int64 ll = (unsigned __int64)pft->dwHighDateTime << 32 | pft->dwLowDateTime;
ll -= 116444736000000000i64;
- return (time_t)(ll / 10000000);
+ return (mir_time)(ll / 10000000);
}
void FormatTime(const SYSTEMTIME *st, const TCHAR *szFormat, TCHAR *szDest, int cbDest)
diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp
index f22b18829c..f1440464f4 100644
--- a/src/modules/utils/timezones.cpp
+++ b/src/modules/utils/timezones.cpp
@@ -94,8 +94,8 @@ static OBJLIST<MIM_TIMEZONE> g_timezones(55, NumericKeySortT);
static LIST<MIM_TIMEZONE> g_timezonesBias(55, MIM_TIMEZONE::compareBias);
void FormatTime (const SYSTEMTIME *st, const TCHAR *szFormat, TCHAR *szDest, int cbDest);
-void UnixTimeToFileTime(time_t ts, LPFILETIME pft);
-time_t FileTimeToUnixTime(LPFILETIME pft);
+void UnixTimeToFileTime(mir_time ts, LPFILETIME pft);
+mir_time FileTimeToUnixTime(LPFILETIME pft);
#define fnSystemTimeToTzSpecificLocalTime SystemTimeToTzSpecificLocalTime
@@ -136,13 +136,13 @@ static void CalcTsOffset(MIM_TIMEZONE *tz)
FILETIME ft;
SystemTimeToFileTime(&st, &ft);
- time_t ts1 = FileTimeToUnixTime(&ft);
+ mir_time ts1 = FileTimeToUnixTime(&ft);
if ( !fnSystemTimeToTzSpecificLocalTime(&tz->tzi, &st, &stl))
return;
SystemTimeToFileTime(&stl, &ft);
- time_t ts2 = FileTimeToUnixTime(&ft);
+ mir_time ts2 = FileTimeToUnixTime(&ft);
tz->offset = ts2 - ts1;
}
@@ -273,7 +273,7 @@ static int timeapiPrintDateTime(HANDLE hTZ, LPCTSTR szFormat, LPTSTR szDest, int
return 0;
}
-static int timeapiPrintTimeStamp(HANDLE hTZ, time_t ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags)
+static int timeapiPrintTimeStamp(HANDLE hTZ, mir_time ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags)
{
MIM_TIMEZONE *tz = (MIM_TIMEZONE*)hTZ;
if (tz == NULL && (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)))
@@ -314,7 +314,7 @@ static LPTIME_ZONE_INFORMATION timeapiGetTzi(HANDLE hTZ)
}
-static time_t timeapiTimeStampToTimeZoneTimeStamp(HANDLE hTZ, time_t ts)
+static mir_time timeapiTimeStampToTimeZoneTimeStamp(HANDLE hTZ, mir_time ts)
{
MIM_TIMEZONE *tz = (MIM_TIMEZONE*)hTZ;
@@ -472,7 +472,7 @@ static INT_PTR GetTimeApi(WPARAM, LPARAM lParam)
static INT_PTR TimestampToLocal(WPARAM wParam, LPARAM)
{
- return timeapiTimeStampToTimeZoneTimeStamp(NULL, (time_t)wParam);
+ return timeapiTimeStampToTimeZoneTimeStamp(NULL, (mir_time)wParam);
}
static INT_PTR TimestampToStringT(WPARAM wParam, LPARAM lParam)
@@ -480,7 +480,7 @@ static INT_PTR TimestampToStringT(WPARAM wParam, LPARAM lParam)
DBTIMETOSTRINGT *tts = (DBTIMETOSTRINGT*)lParam;
if (tts == NULL) return 0;
- timeapiPrintTimeStamp(NULL, (time_t)wParam, tts->szFormat, tts->szDest, tts->cbDest, 0);
+ timeapiPrintTimeStamp(NULL, (mir_time)wParam, tts->szFormat, tts->szDest, tts->cbDest, 0);
return 0;
}
@@ -490,7 +490,7 @@ static INT_PTR TimestampToStringA(WPARAM wParam, LPARAM lParam)
if (tts == NULL) return 0;
TCHAR *szDest = (TCHAR*)alloca(tts->cbDest);
- timeapiPrintTimeStamp(NULL, (time_t)wParam, StrConvT(tts->szFormat), szDest, tts->cbDest, 0);
+ timeapiPrintTimeStamp(NULL, (mir_time)wParam, StrConvT(tts->szFormat), szDest, tts->cbDest, 0);
WideCharToMultiByte(CP_ACP, 0, szDest, -1, tts->szDest, tts->cbDest, NULL, NULL);
return 0;
}