github.com/searKing/golang/go@v1.2.117/os/signal/cgo/include/boost/winapi/time.hpp (about) 1 /* 2 * Copyright 2010 Vicente J. Botet Escriba 3 * Copyright (c) Microsoft Corporation 2014 4 * Copyright 2015, 2017 Andrey Semashev 5 * 6 * Distributed under the Boost Software License, Version 1.0. 7 * See http://www.boost.org/LICENSE_1_0.txt 8 */ 9 10 #ifndef BOOST_WINAPI_TIME_HPP_INCLUDED_ 11 #define BOOST_WINAPI_TIME_HPP_INCLUDED_ 12 13 #include <boost/winapi/basic_types.hpp> 14 #include <boost/winapi/detail/header.hpp> 15 16 #ifdef BOOST_HAS_PRAGMA_ONCE 17 #pragma once 18 #endif 19 20 #if !defined( BOOST_USE_WINDOWS_H ) 21 extern "C" { 22 struct _FILETIME; 23 struct _SYSTEMTIME; 24 25 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC 26 GetSystemTime(::_SYSTEMTIME* lpSystemTime); 27 28 #ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // Windows CE does not define GetSystemTimeAsFileTime 29 BOOST_WINAPI_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC 30 GetSystemTimeAsFileTime(::_FILETIME* lpSystemTimeAsFileTime); 31 #endif 32 33 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC 34 SystemTimeToFileTime( 35 const ::_SYSTEMTIME* lpSystemTime, 36 ::_FILETIME* lpFileTime); 37 38 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC 39 FileTimeToSystemTime( 40 const ::_FILETIME* lpFileTime, 41 ::_SYSTEMTIME* lpSystemTime); 42 43 #if BOOST_WINAPI_PARTITION_APP_SYSTEM 44 45 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC 46 FileTimeToLocalFileTime( 47 const ::_FILETIME* lpFileTime, 48 ::_FILETIME* lpLocalFileTime); 49 50 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC 51 LocalFileTimeToFileTime( 52 const ::_FILETIME* lpLocalFileTime, 53 ::_FILETIME* lpFileTime); 54 55 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM 56 57 #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM 58 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC 59 GetTickCount(BOOST_WINAPI_DETAIL_VOID); 60 #endif // BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM 61 62 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 63 BOOST_WINAPI_IMPORT boost::winapi::ULONGLONG_ BOOST_WINAPI_WINAPI_CC 64 GetTickCount64(BOOST_WINAPI_DETAIL_VOID); 65 #endif 66 67 } // extern "C" 68 #endif // !defined( BOOST_USE_WINDOWS_H ) 69 70 namespace boost { 71 namespace winapi { 72 73 typedef struct BOOST_MAY_ALIAS _FILETIME { 74 DWORD_ dwLowDateTime; 75 DWORD_ dwHighDateTime; 76 } FILETIME_, *PFILETIME_, *LPFILETIME_; 77 78 typedef struct BOOST_MAY_ALIAS _SYSTEMTIME { 79 WORD_ wYear; 80 WORD_ wMonth; 81 WORD_ wDayOfWeek; 82 WORD_ wDay; 83 WORD_ wHour; 84 WORD_ wMinute; 85 WORD_ wSecond; 86 WORD_ wMilliseconds; 87 } SYSTEMTIME_, *PSYSTEMTIME_, *LPSYSTEMTIME_; 88 89 #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM 90 using ::GetTickCount; 91 #endif 92 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 93 using ::GetTickCount64; 94 #endif 95 96 BOOST_FORCEINLINE VOID_ GetSystemTime(LPSYSTEMTIME_ lpSystemTime) 97 { 98 ::GetSystemTime(reinterpret_cast< ::_SYSTEMTIME* >(lpSystemTime)); 99 } 100 101 BOOST_FORCEINLINE BOOL_ SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime, FILETIME_* lpFileTime) 102 { 103 return ::SystemTimeToFileTime(reinterpret_cast< const ::_SYSTEMTIME* >(lpSystemTime), reinterpret_cast< ::_FILETIME* >(lpFileTime)); 104 } 105 106 BOOST_FORCEINLINE BOOL_ FileTimeToSystemTime(const FILETIME_* lpFileTime, SYSTEMTIME_* lpSystemTime) 107 { 108 return ::FileTimeToSystemTime(reinterpret_cast< const ::_FILETIME* >(lpFileTime), reinterpret_cast< ::_SYSTEMTIME* >(lpSystemTime)); 109 } 110 111 #if BOOST_WINAPI_PARTITION_APP_SYSTEM 112 BOOST_FORCEINLINE BOOL_ FileTimeToLocalFileTime(const FILETIME_* lpFileTime, FILETIME_* lpLocalFileTime) 113 { 114 return ::FileTimeToLocalFileTime(reinterpret_cast< const ::_FILETIME* >(lpFileTime), reinterpret_cast< ::_FILETIME* >(lpLocalFileTime)); 115 } 116 117 BOOST_FORCEINLINE BOOL_ LocalFileTimeToFileTime(const FILETIME_* lpLocalFileTime, FILETIME_* lpFileTime) 118 { 119 return ::LocalFileTimeToFileTime(reinterpret_cast< const ::_FILETIME* >(lpLocalFileTime), reinterpret_cast< ::_FILETIME* >(lpFileTime)); 120 } 121 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM 122 123 #if defined( BOOST_HAS_GETSYSTEMTIMEASFILETIME ) 124 BOOST_FORCEINLINE VOID_ GetSystemTimeAsFileTime(LPFILETIME_ lpSystemTimeAsFileTime) 125 { 126 ::GetSystemTimeAsFileTime(reinterpret_cast< ::_FILETIME* >(lpSystemTimeAsFileTime)); 127 } 128 #else 129 // Windows CE does not define GetSystemTimeAsFileTime 130 BOOST_FORCEINLINE VOID_ GetSystemTimeAsFileTime(FILETIME_* lpFileTime) 131 { 132 boost::winapi::SYSTEMTIME_ st; 133 boost::winapi::GetSystemTime(&st); 134 boost::winapi::SystemTimeToFileTime(&st, lpFileTime); 135 } 136 #endif 137 138 } 139 } 140 141 #include <boost/winapi/detail/footer.hpp> 142 143 #endif // BOOST_WINAPI_TIME_HPP_INCLUDED_