86 lines
2.2 KiB
C++
Raw Normal View History

2012-07-21 11:37:40 -07:00
// time.hpp --------------------------------------------------------------//
// Copyright 2010 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
2014-03-01 11:00:20 -08:00
#ifndef BOOST_DETAIL_WINAPI_TIME_HPP
#define BOOST_DETAIL_WINAPI_TIME_HPP
2012-07-21 11:37:40 -07:00
2014-03-01 11:00:20 -08:00
#include <boost/detail/winapi/basic_types.hpp>
2012-07-21 11:37:40 -07:00
2014-03-01 11:00:20 -08:00
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
2012-07-21 11:37:40 -07:00
namespace boost {
namespace detail {
2014-03-01 11:00:20 -08:00
namespace winapi {
2012-07-21 11:37:40 -07:00
#if defined( BOOST_USE_WINDOWS_H )
typedef FILETIME FILETIME_;
typedef PFILETIME PFILETIME_;
typedef LPFILETIME LPFILETIME_;
typedef SYSTEMTIME SYSTEMTIME_;
typedef SYSTEMTIME* PSYSTEMTIME_;
2014-03-01 11:00:20 -08:00
#ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // Windows CE does not define GetSystemTimeAsFileTime
2012-07-21 11:37:40 -07:00
using ::GetSystemTimeAsFileTime;
#endif
using ::FileTimeToLocalFileTime;
using ::GetSystemTime;
using ::SystemTimeToFileTime;
using ::GetTickCount;
#else
extern "C" {
typedef struct _FILETIME {
DWORD_ dwLowDateTime;
DWORD_ dwHighDateTime;
} FILETIME_, *PFILETIME_, *LPFILETIME_;
typedef struct _SYSTEMTIME {
WORD_ wYear;
WORD_ wMonth;
WORD_ wDayOfWeek;
WORD_ wDay;
WORD_ wHour;
WORD_ wMinute;
WORD_ wSecond;
WORD_ wMilliseconds;
} SYSTEMTIME_, *PSYSTEMTIME_;
2014-03-01 11:00:20 -08:00
#ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // Windows CE does not define GetSystemTimeAsFileTime
2012-07-21 11:37:40 -07:00
__declspec(dllimport) void WINAPI
GetSystemTimeAsFileTime(FILETIME_* lpFileTime);
#endif
__declspec(dllimport) int WINAPI
2014-03-01 11:00:20 -08:00
FileTimeToLocalFileTime(const FILETIME_* lpFileTime,
2012-07-21 11:37:40 -07:00
FILETIME_* lpLocalFileTime);
__declspec(dllimport) void WINAPI
GetSystemTime(SYSTEMTIME_* lpSystemTime);
__declspec(dllimport) int WINAPI
2014-03-01 11:00:20 -08:00
SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime,
2012-07-21 11:37:40 -07:00
FILETIME_* lpFileTime);
2014-03-01 11:00:20 -08:00
__declspec(dllimport) DWORD_ WINAPI
2012-07-21 11:37:40 -07:00
GetTickCount();
}
#endif
2014-03-01 11:00:20 -08:00
#ifndef BOOST_HAS_GETSYSTEMTIMEASFILETIME
inline void WINAPI GetSystemTimeAsFileTime(FILETIME_* lpFileTime)
{
SYSTEMTIME_ st;
GetSystemTime(&st);
SystemTimeToFileTime(&st, lpFileTime);
}
#endif
2012-07-21 11:37:40 -07:00
}
}
}
2014-03-01 11:00:20 -08:00
#endif // BOOST_DETAIL_WINAPI_TIME_HPP