Commit 37a23687 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Factor out get_time_stamp helper.

parent 8b6a3f55
......@@ -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))
......
......@@ -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,
......
......@@ -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;
}
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