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

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2018-04-18 20:38:18 +02:00 committed by Alexandre Julliard
parent 45eb3cb4fc
commit 7a50abd894
3 changed files with 57 additions and 4 deletions

View File

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

View File

@ -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 */

View File

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