vbscript: Implemented Timer.

This commit is contained in:
Shuai Meng 2014-10-13 17:18:24 +08:00 committed by Alexandre Julliard
parent a1ff4f904e
commit 7a48601047
2 changed files with 19 additions and 2 deletions

View File

@ -130,6 +130,16 @@ static inline HRESULT return_double(VARIANT *res, double val)
return S_OK;
}
static inline HRESULT return_float(VARIANT *res, float val)
{
if(res) {
V_VT(res) = VT_R4;
V_R4(res) = val;
}
return S_OK;
}
static inline HRESULT return_null(VARIANT *res)
{
if(res)
@ -760,8 +770,13 @@ static HRESULT Global_Rnd(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
static HRESULT Global_Timer(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
SYSTEMTIME lt;
double sec;
GetLocalTime(&lt);
sec = lt.wHour * 3600 + lt.wMinute * 60 + lt.wSecond + lt.wMilliseconds / 1000.0;
return return_float(res, sec);
}
static HRESULT Global_LBound(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)

View File

@ -1264,4 +1264,6 @@ Call ok(getVT(RGB(&h1&, &h100&, &h111&)) = "VT_I4", "getVT(RGB(&h1&, &h100&, &h1
Call testRGBError(-1, &h1e&, &h3b&, 5)
Call testRGBError(&h4d&, -2, &h2f&, 5)
Call ok(getVT(Timer) = "VT_R4", "getVT(Timer) = " & getVT(Timer))
Call reportSuccess()