Commit 9554e44e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added Now() implementation.

parent c5a4878f
...@@ -130,6 +130,15 @@ static inline HRESULT return_null(VARIANT *res) ...@@ -130,6 +130,15 @@ static inline HRESULT return_null(VARIANT *res)
return S_OK; 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) static HRESULT to_int(VARIANT *v, int *ret)
{ {
switch(V_VT(v)) { switch(V_VT(v)) {
...@@ -967,8 +976,14 @@ static HRESULT Global_Sgn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA ...@@ -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) static HRESULT Global_Now(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{ {
FIXME("\n"); SYSTEMTIME lt;
return E_NOTIMPL; 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) static HRESULT Global_Date(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
......
...@@ -232,4 +232,6 @@ if isEnglishLang then ...@@ -232,4 +232,6 @@ if isEnglishLang then
Call ok(MonthName(12, true) = "Dec", "MonthName(12, true) = " & MonthName(12, true)) Call ok(MonthName(12, true) = "Dec", "MonthName(12, true) = " & MonthName(12, true))
end if end if
Call ok(getVT(Now()) = "VT_DATE", "getVT(Now()) = " & getVT(Now()))
Call reportSuccess() Call reportSuccess()
...@@ -173,6 +173,8 @@ static const char *vt2a(VARIANT *v) ...@@ -173,6 +173,8 @@ static const char *vt2a(VARIANT *v)
return "VT_I4"; return "VT_I4";
case VT_R8: case VT_R8:
return "VT_R8"; return "VT_R8";
case VT_DATE:
return "VT_DATE";
case VT_BSTR: case VT_BSTR:
return "VT_BSTR"; return "VT_BSTR";
case VT_DISPATCH: case VT_DISPATCH:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment