Shuai Meng : vbscript: Implemented Timer.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Oct 14 09:37:29 CDT 2014
Module: wine
Branch: master
Commit: 7a4860104772597b70444238b82887bd0932f783
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7a4860104772597b70444238b82887bd0932f783
Author: Shuai Meng <mengshuaicalendr at gmail.com>
Date: Mon Oct 13 17:18:24 2014 +0800
vbscript: Implemented Timer.
---
dlls/vbscript/global.c | 19 +++++++++++++++++--
dlls/vbscript/tests/api.vbs | 2 ++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index 93fdcc3..bbbe22c 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -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(<);
+ 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)
diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs
index e2efa98..1b68d2e 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -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()
More information about the wine-cvs
mailing list