From 88d7f611a4b389eec37d6478bfe683d031f0dd48 Mon Sep 17 00:00:00 2001 From: Shuai Meng Date: Tue, 26 Aug 2014 00:07:51 +0800 Subject: [PATCH] vbscript: Implemented Date. --- dlls/vbscript/global.c | 16 ++++++++++++++-- dlls/vbscript/tests/api.vbs | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 666334346fe..c512729c5ca 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -1400,8 +1400,20 @@ static HRESULT Global_Now(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA static HRESULT Global_Date(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + SYSTEMTIME lt; + UDATE ud; + DATE date; + HRESULT hres; + + TRACE("\n"); + + GetLocalTime(<); + ud.st = lt; + ud.wDayOfYear = 0; + hres = VarDateFromUdateEx(&ud, 0, VAR_DATEVALUEONLY, &date); + if(FAILED(hres)) + return hres; + return return_date(res, date); } static HRESULT Global_Time(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index 44c80de1c80..ab8771783fa 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -1237,4 +1237,6 @@ Call ok(getVT(Log("10")) = "VT_R8", "getVT(Log(""10"")) = " & getVT(Log("10"))) Call ok(Approch(Log(CByte(2)), 0.6931), "Log(CByte(2)) = " & Log(CByte(2))) Call ok(getVT(Log(CByte(2))) = "VT_R8", "getVT(Log(CByte(2))) = " & getVT(Log(CByte(2)))) +Call ok(getVT(Date) = "VT_DATE", "getVT(Date) = " & getVT(Date)) + Call reportSuccess()