Commit 7a50abd8 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

ucrtbase: Add _timespec{32,64}_get implementation.

parent 45eb3cb4
......@@ -47,8 +47,8 @@
@ cdecl _strtime_s(ptr long) ucrtbase._strtime_s
@ cdecl _time32(ptr) ucrtbase._time32
@ cdecl _time64(ptr) ucrtbase._time64
@ stub _timespec32_get
@ stub _timespec64_get
@ cdecl _timespec32_get(ptr long) ucrtbase._timespec32_get
@ cdecl _timespec64_get(ptr long) ucrtbase._timespec64_get
@ cdecl _tzset() ucrtbase._tzset
@ cdecl _utime32(str ptr) ucrtbase._utime32
@ cdecl _utime64(str ptr) ucrtbase._utime64
......
......@@ -1620,3 +1620,56 @@ int CDECL _get_daylight(int *hours)
}
#endif /* _MSVCR_VER >= 80 */
#if _MSVCR_VER >= 140
#define TIME_UTC 1
struct _timespec32
{
MSVCRT___time32_t tv_sec;
LONG tv_nsec;
};
struct _timespec64
{
MSVCRT___time64_t tv_sec;
LONG tv_nsec;
};
/*********************************************************************
* _timespec64_get (UCRTBASE.@)
*/
int CDECL _timespec64_get(struct _timespec64 *ts, int base)
{
ULONGLONG time;
FILETIME ft;
if(!MSVCRT_CHECK_PMT(ts != NULL)) return 0;
if(base != TIME_UTC) return 0;
GetSystemTimePreciseAsFileTime(&ft);
time = ((ULONGLONG)ft.dwHighDateTime << 32) | ft.dwLowDateTime;
ts->tv_sec = time / TICKSPERSEC - SECS_1601_TO_1970;
ts->tv_nsec = time % TICKSPERSEC * 100;
return base;
}
/*********************************************************************
* _timespec32_get (UCRTBASE.@)
*/
int CDECL _timespec32_get(struct _timespec32 *ts, int base)
{
struct _timespec64 ts64;
if(_timespec64_get(&ts64, base) != base)
return 0;
if(ts64.tv_sec != (MSVCRT___time32_t)ts64.tv_sec)
return 0;
ts->tv_sec = ts64.tv_sec;
ts->tv_nsec = ts64.tv_nsec;
return base;
}
#endif /* _MSVCR_VER >= 140 */
......@@ -1972,8 +1972,8 @@
@ cdecl _tempnam(str str) MSVCRT__tempnam
@ cdecl _time32(ptr) MSVCRT__time32
@ cdecl _time64(ptr) MSVCRT__time64
@ stub _timespec32_get
@ stub _timespec64_get
@ cdecl _timespec32_get(ptr long)
@ cdecl _timespec64_get(ptr long)
@ cdecl _tolower(long) MSVCRT__tolower
@ cdecl _tolower_l(long ptr) MSVCRT__tolower_l
@ cdecl _toupper(long) MSVCRT__toupper
......
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