From 5e85f48b85b54342b8bb472c10c5593abbb8b1eb Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Sun, 14 Dec 2014 12:43:21 +0000 Subject: mra: w4 fixs git-svn-id: http://svn.miranda-ng.org/main/trunk@11401 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MRA/src/Sdk/InternetTime.h | 42 ++++++++++++++++++++---------------- protocols/MRA/src/Sdk/timefuncs.h | 14 ++++++++++++ 2 files changed, 37 insertions(+), 19 deletions(-) (limited to 'protocols/MRA/src/Sdk') diff --git a/protocols/MRA/src/Sdk/InternetTime.h b/protocols/MRA/src/Sdk/InternetTime.h index 8052bb9ea6..d1bd7e50aa 100644 --- a/protocols/MRA/src/Sdk/InternetTime.h +++ b/protocols/MRA/src/Sdk/InternetTime.h @@ -129,31 +129,35 @@ __inline CMStringA InternetTimeGetString(INTERNET_TIME *pitTime) { char lpszBuff[100]; LPSTR lpszCurPos = lpszBuff; - size_t dwTimeLen=0,dwtm; + size_t dwTimeLen = 0, dwtm; // day of weak// date of mounth// mounth name// year// hours // minutes// seconds - dwtm=wsprintfA(lpszCurPos,"%s, %02lu %s %04lu %02lu:%02lu:%02lu ",lpcszenmDayOfWeakEnum[pitTime->stTime.wDayOfWeek],pitTime->stTime.wDay,lpcszenmMonthEnum[pitTime->stTime.wMonth],pitTime->stTime.wYear,pitTime->stTime.wHour,pitTime->stTime.wMinute,pitTime->stTime.wSecond); - lpszCurPos+=dwtm; - dwTimeLen+=dwtm; + dwtm = wsprintfA(lpszCurPos, "%s, %02lu %s %04lu %02lu:%02lu:%02lu ", + lpcszenmDayOfWeakEnum[pitTime->stTime.wDayOfWeek], + pitTime->stTime.wDay, + lpcszenmMonthEnum[pitTime->stTime.wMonth], + pitTime->stTime.wYear, + pitTime->stTime.wHour, + pitTime->stTime.wMinute, + pitTime->stTime.wSecond); + lpszCurPos += dwtm; + dwTimeLen += dwtm; // time zone - if (pitTime->lTimeZone) - { - if (pitTime->lTimeZone < 0) - {// нужно добавить плюсик, минус добавляется автоматом - (*((BYTE*)lpszCurPos))='+'; - lpszCurPos++; - dwTimeLen++; + if (pitTime->lTimeZone) { + if (pitTime->lTimeZone < 0) { // нужно добавить плюсик, минус добавляется автоматом + (*((BYTE*)lpszCurPos)) = '+'; + lpszCurPos ++; + dwTimeLen ++; } - dwtm=wsprintfA(lpszCurPos,"%04ld",-(((pitTime->lTimeZone/60)*100)+pitTime->lTimeZone%60)); - lpszCurPos+=dwtm; - dwTimeLen+=dwtm; - } - else{ - dwtm=wsprintfA(lpszCurPos,"GMT"); - lpszCurPos+=dwtm; - dwTimeLen+=dwtm; + dwtm = wsprintfA(lpszCurPos, "%04ld", -(((pitTime->lTimeZone / 60) * 100) + pitTime->lTimeZone % 60)); + lpszCurPos += dwtm; + dwTimeLen += dwtm; + } else { + dwtm = wsprintfA(lpszCurPos, "GMT"); + lpszCurPos += dwtm; + dwTimeLen += dwtm; } return lpszBuff; diff --git a/protocols/MRA/src/Sdk/timefuncs.h b/protocols/MRA/src/Sdk/timefuncs.h index eaee4a7e80..0bff545803 100644 --- a/protocols/MRA/src/Sdk/timefuncs.h +++ b/protocols/MRA/src/Sdk/timefuncs.h @@ -51,6 +51,20 @@ typedef union { } FT; +inline __time32_t _time32(__time32_t *timeptr) +{ + __time64_t tim; + FT nt_time; + + GetSystemTimeAsFileTime(&(nt_time.ft_struct)); + tim=(__time64_t)((nt_time.ft_scalar-EPOCH_BIAS)/10000000i64); + if (tim > (__time64_t)(_MAX__TIME32_T)) tim=(__time64_t)(-1); + if (timeptr) *timeptr = (__time32_t)(tim);// store time if requested + +return(__time32_t)(tim); +} + + inline __time32_t MakeTime32FromLocalSystemTime(CONST PSYSTEMTIME pcstSystemTime) { __time64_t tim=0; -- cgit v1.2.3