mshtml: Factor out get_time_stamp helper.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-04-22 01:49:11 +02:00 committed by Alexandre Julliard
parent 8b6a3f554a
commit 37a2368703
3 changed files with 13 additions and 7 deletions

View File

@ -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))

View File

@ -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,

View File

@ -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;
}