Commit b8dc6b24 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Move RtlGetSystemTimePrecise() to the Unix library.

parent 13c1f008
......@@ -32,9 +32,6 @@
#include <string.h>
#include <limits.h>
#include <time.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
......@@ -399,27 +396,7 @@ NTSTATUS WINAPI NtQuerySystemTime( LARGE_INTEGER *time )
*/
LONGLONG WINAPI RtlGetSystemTimePrecise( void )
{
LONGLONG time;
#ifdef HAVE_CLOCK_GETTIME
struct timespec ts;
if (!clock_gettime( CLOCK_REALTIME, &ts ))
{
time = ts.tv_sec * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970;
time += (ts.tv_nsec + 50) / 100;
}
else
#endif
{
struct timeval now;
gettimeofday( &now, 0 );
time = now.tv_sec * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970;
time += now.tv_usec * 10;
}
return time;
return unix_funcs->RtlGetSystemTimePrecise();
}
/******************************************************************************
......
......@@ -1450,6 +1450,7 @@ static struct unix_funcs unix_funcs =
NtWriteVirtualMemory,
NtYieldExecution,
DbgUiIssueRemoteBreakin,
RtlGetSystemTimePrecise,
RtlWaitOnAddress,
RtlWakeAddressAll,
RtlWakeAddressSingle,
......
......@@ -679,7 +679,7 @@ unsigned int server_wait( const select_op_t *select_op, data_size_t size, UINT f
{
LARGE_INTEGER now;
RtlQueryPerformanceCounter(&now);
NtQueryPerformanceCounter( &now, NULL );
abs_timeout -= now.QuadPart;
}
......
......@@ -1044,7 +1044,7 @@ NTSTATUS WINAPI NtQueryTimer( HANDLE handle, TIMER_INFORMATION_CLASS class,
if (basic_info->RemainingTime.QuadPart > 0) NtQuerySystemTime( &now );
else
{
RtlQueryPerformanceCounter( &now );
NtQueryPerformanceCounter( &now, NULL );
basic_info->RemainingTime.QuadPart = -basic_info->RemainingTime.QuadPart;
}
......@@ -1243,6 +1243,23 @@ ULONG WINAPI NtGetTickCount(void)
/******************************************************************************
* RtlGetSystemTimePrecise (NTDLL.@)
*/
LONGLONG WINAPI RtlGetSystemTimePrecise(void)
{
struct timeval now;
#ifdef HAVE_CLOCK_GETTIME
struct timespec ts;
if (!clock_gettime( CLOCK_REALTIME, &ts ))
return ts.tv_sec * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970 + (ts.tv_nsec + 50) / 100;
#endif
gettimeofday( &now, 0 );
return now.tv_sec * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970 + now.tv_usec * 10;
}
/******************************************************************************
* NtCreateKeyedEvent (NTDLL.@)
*/
NTSTATUS WINAPI NtCreateKeyedEvent( HANDLE *handle, ACCESS_MASK access,
......@@ -2248,7 +2265,7 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
{
LARGE_INTEGER now;
RtlQueryPerformanceCounter(&now);
NtQueryPerformanceCounter( &now, NULL );
abs_timeout -= now.QuadPart;
}
......
......@@ -89,6 +89,7 @@ extern NTSTATUS CDECL fast_RtlSleepConditionVariableCS( RTL_CONDITION_VARIABLE *
RTL_CRITICAL_SECTION *cs,
const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL fast_RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable, int count ) DECLSPEC_HIDDEN;
extern LONGLONG CDECL fast_RtlGetSystemTimePrecise(void) DECLSPEC_HIDDEN;
void CDECL mmap_add_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
......
......@@ -29,7 +29,7 @@ struct msghdr;
struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 62
#define NTDLL_UNIXLIB_VERSION 63
struct unix_funcs
{
......@@ -261,6 +261,7 @@ struct unix_funcs
/* other Win32 API functions */
NTSTATUS (WINAPI *DbgUiIssueRemoteBreakin)( HANDLE process );
LONGLONG (WINAPI *RtlGetSystemTimePrecise)(void);
NTSTATUS (WINAPI *RtlWaitOnAddress)( const void *addr, const void *cmp, SIZE_T size,
const LARGE_INTEGER *timeout );
void (WINAPI *RtlWakeAddressAll)( const void *addr );
......
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