vbscript: Added Now() implementation.

This commit is contained in:
Jacek Caban 2012-09-28 11:49:30 +02:00 committed by Alexandre Julliard
parent c5a4878f5f
commit 9554e44e47
3 changed files with 21 additions and 2 deletions

View File

@ -130,6 +130,15 @@ static inline HRESULT return_null(VARIANT *res)
return S_OK;
}
static inline HRESULT return_date(VARIANT *res, double date)
{
if(res) {
V_VT(res) = VT_DATE;
V_DATE(res) = date;
}
return S_OK;
}
static HRESULT to_int(VARIANT *v, int *ret)
{
switch(V_VT(v)) {
@ -967,8 +976,14 @@ static HRESULT Global_Sgn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
static HRESULT Global_Now(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
SYSTEMTIME lt;
double date;
TRACE("\n");
GetLocalTime(&lt);
SystemTimeToVariantTime(&lt, &date);
return return_date(res, date);
}
static HRESULT Global_Date(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)

View File

@ -232,4 +232,6 @@ if isEnglishLang then
Call ok(MonthName(12, true) = "Dec", "MonthName(12, true) = " & MonthName(12, true))
end if
Call ok(getVT(Now()) = "VT_DATE", "getVT(Now()) = " & getVT(Now()))
Call reportSuccess()

View File

@ -173,6 +173,8 @@ static const char *vt2a(VARIANT *v)
return "VT_I4";
case VT_R8:
return "VT_R8";
case VT_DATE:
return "VT_DATE";
case VT_BSTR:
return "VT_BSTR";
case VT_DISPATCH: