1 // time.hpp --------------------------------------------------------------//
3 // Copyright 2010 Vicente J. Botet Escriba
4 // Copyright (c) Microsoft Corporation 2014
5 // Copyright 2015 Andrey Semashev
7 // Distributed under the Boost Software License, Version 1.0.
8 // See http://www.boost.org/LICENSE_1_0.txt
11 #ifndef BOOST_DETAIL_WINAPI_TIME_HPP
12 #define BOOST_DETAIL_WINAPI_TIME_HPP
14 #include <boost/detail/winapi/basic_types.hpp>
15 #include <boost/predef/platform.h>
17 #ifdef BOOST_HAS_PRAGMA_ONCE
21 #if !defined( BOOST_USE_WINDOWS_H )
26 BOOST_SYMBOL_IMPORT boost::detail::winapi::VOID_ WINAPI
27 GetSystemTime(::_SYSTEMTIME* lpSystemTime);
29 #ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // Windows CE does not define GetSystemTimeAsFileTime
30 BOOST_SYMBOL_IMPORT boost::detail::winapi::VOID_ WINAPI
31 GetSystemTimeAsFileTime(::_FILETIME* lpSystemTimeAsFileTime);
34 BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
36 const ::_SYSTEMTIME* lpSystemTime,
37 ::_FILETIME* lpFileTime);
39 BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
41 const ::_FILETIME* lpFileTime,
42 ::_SYSTEMTIME* lpSystemTime);
44 #if BOOST_PLAT_WINDOWS_DESKTOP
45 BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
46 FileTimeToLocalFileTime(
47 const ::_FILETIME* lpFileTime,
48 ::_FILETIME* lpLocalFileTime);
50 BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
51 LocalFileTimeToFileTime(
52 const ::_FILETIME* lpLocalFileTime,
53 ::_FILETIME* lpFileTime);
55 BOOST_SYMBOL_IMPORT boost::detail::winapi::DWORD_ WINAPI
56 GetTickCount(BOOST_DETAIL_WINAPI_VOID);
59 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
60 BOOST_SYMBOL_IMPORT boost::detail::winapi::ULONGLONG_ WINAPI
61 GetTickCount64(BOOST_DETAIL_WINAPI_VOID);
70 typedef struct BOOST_DETAIL_WINAPI_MAY_ALIAS _FILETIME {
72 DWORD_ dwHighDateTime;
73 } FILETIME_, *PFILETIME_, *LPFILETIME_;
75 typedef struct BOOST_DETAIL_WINAPI_MAY_ALIAS _SYSTEMTIME {
84 } SYSTEMTIME_, *PSYSTEMTIME_, *LPSYSTEMTIME_;
86 #if BOOST_PLAT_WINDOWS_DESKTOP
89 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
90 using ::GetTickCount64;
93 BOOST_FORCEINLINE VOID_ GetSystemTime(LPSYSTEMTIME_ lpSystemTime)
95 ::GetSystemTime(reinterpret_cast< ::_SYSTEMTIME* >(lpSystemTime));
98 #if defined( BOOST_HAS_GETSYSTEMTIMEASFILETIME )
99 BOOST_FORCEINLINE VOID_ GetSystemTimeAsFileTime(LPFILETIME_ lpSystemTimeAsFileTime)
101 ::GetSystemTimeAsFileTime(reinterpret_cast< ::_FILETIME* >(lpSystemTimeAsFileTime));
104 // Windows CE does not define GetSystemTimeAsFileTime
105 BOOST_FORCEINLINE VOID_ GetSystemTimeAsFileTime(FILETIME_* lpFileTime)
107 boost::detail::winapi::SYSTEMTIME_ st;
108 boost::detail::winapi::GetSystemTime(&st);
109 boost::detail::winapi::SystemTimeToFileTime(&st, lpFileTime);
113 BOOST_FORCEINLINE BOOL_ SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime, FILETIME_* lpFileTime)
115 return ::SystemTimeToFileTime(reinterpret_cast< const ::_SYSTEMTIME* >(lpSystemTime), reinterpret_cast< ::_FILETIME* >(lpFileTime));
118 BOOST_FORCEINLINE BOOL_ FileTimeToSystemTime(const FILETIME_* lpFileTime, SYSTEMTIME_* lpSystemTime)
120 return ::FileTimeToSystemTime(reinterpret_cast< const ::_FILETIME* >(lpFileTime), reinterpret_cast< ::_SYSTEMTIME* >(lpSystemTime));
123 #if BOOST_PLAT_WINDOWS_DESKTOP
124 BOOST_FORCEINLINE BOOL_ FileTimeToLocalFileTime(const FILETIME_* lpFileTime, FILETIME_* lpLocalFileTime)
126 return ::FileTimeToLocalFileTime(reinterpret_cast< const ::_FILETIME* >(lpFileTime), reinterpret_cast< ::_FILETIME* >(lpLocalFileTime));
129 BOOST_FORCEINLINE BOOL_ LocalFileTimeToFileTime(const FILETIME_* lpLocalFileTime, FILETIME_* lpFileTime)
131 return ::LocalFileTimeToFileTime(reinterpret_cast< const ::_FILETIME* >(lpLocalFileTime), reinterpret_cast< ::_FILETIME* >(lpFileTime));
139 #endif // BOOST_DETAIL_WINAPI_TIME_HPP