summaryrefslogtreecommitdiff
path: root/protocols/MRA/src/Sdk
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-01 19:08:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-01 19:08:53 +0000
commit84567ddcd9ff730cdcb7815b6ba0007d693cd52b (patch)
tree3ee57fc2ac744c030e86df86fcf56aaa8845938b /protocols/MRA/src/Sdk
parent856648d8c6f14c7d57aba610588f52c79ec18987 (diff)
VERY EXPERIMENTAL VERSION OF MEA, DON'T USE IN PRODUCTION
git-svn-id: http://svn.miranda-ng.org/main/trunk@5897 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA/src/Sdk')
-rw-r--r--protocols/MRA/src/Sdk/InternetTime.h63
1 files changed, 29 insertions, 34 deletions
diff --git a/protocols/MRA/src/Sdk/InternetTime.h b/protocols/MRA/src/Sdk/InternetTime.h
index dae0ee0ce3..b226929299 100644
--- a/protocols/MRA/src/Sdk/InternetTime.h
+++ b/protocols/MRA/src/Sdk/InternetTime.h
@@ -282,61 +282,56 @@ __inline void InternetTimeGetCurrentTime(INTERNET_TIME *pitTime)
}
-__inline DWORD InternetTimeGetString(INTERNET_TIME *pitTime,LPSTR lpszBuff,size_t dwBuffSize,size_t *pdwBuffSizeRet)
+__inline CMStringA InternetTimeGetString(INTERNET_TIME *pitTime)
{// Переводит время из MAILTIME в строковое
DWORD dwRet=NO_ERROR;
- if (dwBuffSize>31)
- {
- LPSTR lpszCurPos=lpszBuff;
- size_t dwTimeLen=0,dwtm;
+ char lpszBuff[100];
+ LPSTR lpszCurPos = lpszBuff;
+ 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;
+ // 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;
- // time zone
- 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;
+ // time zone
+ if (pitTime->lTimeZone)
+ {
+ if (pitTime->lTimeZone < 0)
+ {// нужно добавить плюсик, минус добавляется автоматом
+ (*((BYTE*)lpszCurPos))='+';
+ lpszCurPos++;
+ dwTimeLen++;
}
- if (pdwBuffSizeRet) (*pdwBuffSizeRet)=dwTimeLen;
- }else{// переданный буффер слишком мал
- if (pdwBuffSizeRet) (*pdwBuffSizeRet)=32;
- dwRet=ERROR_INSUFFICIENT_BUFFER;
+ dwtm=wsprintfA(lpszCurPos,"%04ld",-(((pitTime->lTimeZone/60)*100)+pitTime->lTimeZone%60));
+ lpszCurPos+=dwtm;
+ dwTimeLen+=dwtm;
}
-return(dwRet);
+ else{
+ dwtm=wsprintfA(lpszCurPos,"GMT");
+ lpszCurPos+=dwtm;
+ dwTimeLen+=dwtm;
+ }
+
+ return lpszBuff;
}
-__inline DWORD InternetTimeGetTime(LPCSTR lpszTime,size_t dwTimeSize,INTERNET_TIME *pitTime)
+__inline DWORD InternetTimeGetTime(const CMStringA &lpszTime, INTERNET_TIME *pitTime)
{// Переводит время из строкового в INTERNET_TIME
DWORD dwRet=NO_ERROR;
- if (lpszTime && dwTimeSize && dwTimeSize<4097 && pitTime)
+ if (!lpszTime.IsEmpty() && pitTime)
{// = Thu, 21 May 1998 05:33:29 -0700 =
char sztmBuff[4096];
LPSTR lpszCurPos=sztmBuff,lpszTemp;
size_t i,dwCurSize=4096,dwTemp;
memset(pitTime, 0, sizeof(INTERNET_TIME));
- WSP2SP((LPSTR)lpszTime,dwTimeSize,lpszCurPos,&dwCurSize);
+ WSP2SP(lpszTime, lpszTime.GetLength(), lpszCurPos, &dwCurSize);
if (dwCurSize>3)
{// день недели