Module: wine Branch: master Commit: 37a236870388fb1ba3e5e29ecef3f8d0a2a8cd5b URL: https://source.winehq.org/git/wine.git/?a=commit;h=37a236870388fb1ba3e5e29ec...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Apr 22 01:49:11 2021 +0200
mshtml: Factor out get_time_stamp helper.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/mshtml/htmlevent.c | 8 +------- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/task.c | 11 +++++++++++ 3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 51b976c2077..b3b95083f80 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -2208,12 +2208,8 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, ev { dispex_static_data_t *dispex_data = &DOMEvent_dispex; DOMEvent *event = NULL; - FILETIME time; nsresult nsres;
- /* 1601 to 1970 is 369 years plus 89 leap days */ - const ULONGLONG time_epoch = (ULONGLONG)(369 * 365 + 89) * 86400 * 1000; - if(check_event_iface(nsevent, &IID_nsIDOMCustomEvent)) { DOMCustomEvent *custom_event = heap_alloc_zero(sizeof(*custom_event)); if(!custom_event) @@ -2247,9 +2243,7 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, ev } nsIDOMEvent_AddRef(event->nsevent = nsevent);
- GetSystemTimeAsFileTime(&time); - event->time_stamp = (((ULONGLONG)time.dwHighDateTime<<32) + time.dwLowDateTime) / 10000 - - time_epoch; + event->time_stamp = get_time_stamp();
nsres = nsIDOMEvent_QueryInterface(nsevent, &IID_nsIDOMUIEvent, (void**)&event->ui_event); if(NS_SUCCEEDED(nsres)) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 4cbddb68022..9d1737cc81f 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1212,6 +1212,7 @@ HWND get_thread_hwnd(void) DECLSPEC_HIDDEN; LONG get_task_target_magic(void) DECLSPEC_HIDDEN; HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN; void remove_target_tasks(LONG) DECLSPEC_HIDDEN; +ULONGLONG get_time_stamp(void) DECLSPEC_HIDDEN;
enum timer_type { TIMER_TIMEOUT, diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c index c26f3754fd4..b7616058461 100644 --- a/dlls/mshtml/task.c +++ b/dlls/mshtml/task.c @@ -380,3 +380,14 @@ thread_data_t *get_thread_data(BOOL create)
return thread_data; } + +ULONGLONG get_time_stamp(void) +{ + FILETIME time; + + /* 1601 to 1970 is 369 years plus 89 leap days */ + const ULONGLONG time_epoch = (ULONGLONG)(369 * 365 + 89) * 86400 * 1000; + + GetSystemTimeAsFileTime(&time); + return (((ULONGLONG)time.dwHighDateTime << 32) + time.dwLowDateTime) / 10000 - time_epoch; +}