clean up use of _WIN32
Replace the use of _WIN32 in libc++. Replace most use with a C runtime
check _LIBCPP_MSVCRT or the new _LIBCPP_WIN32 to indicate that we are
using the Win32 API. Use a new _LIBCPP_WCHAR_IS_UCS2 to indicate that we
are on an environment that has a short wchar_t.
llvm-svn: 290910
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: b2826a1ddc761fb6abcf8d80793a20387e9dc5f6
diff --git a/src/chrono.cpp b/src/chrono.cpp
index 28cdb9d..8c8e6b5 100644
--- a/src/chrono.cpp
+++ b/src/chrono.cpp
@@ -12,7 +12,7 @@
#include "system_error" // __throw_system_error
#include <time.h> // clock_gettime, CLOCK_MONOTONIC and CLOCK_REALTIME
-#if defined(_WIN32)
+#if defined(_LIBCPP_WIN32API)
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRA_LEAN
#include <Windows.h>
@@ -22,13 +22,13 @@
#else
#if !defined(CLOCK_REALTIME)
#include <sys/time.h> // for gettimeofday and timeval
-#endif
-#endif
+#endif // !defined(CLOCK_REALTIME)
+#endif // defined(_LIBCPP_WIN32API)
#if !defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK)
#if __APPLE__
#include <mach/mach_time.h> // mach_absolute_time, mach_timebase_info_data_t
-#elif !defined(_WIN32) && !defined(CLOCK_MONOTONIC)
+#elif !defined(_LIBCPP_WIN32API) && !defined(CLOCK_MONOTONIC)
#error "Monotonic clock not implemented"
#endif
#endif
@@ -45,7 +45,7 @@
system_clock::time_point
system_clock::now() _NOEXCEPT
{
-#if defined(_WIN32)
+#if defined(_LIBCPP_WIN32API)
// FILETIME is in 100ns units
using filetime_duration =
_VSTD::chrono::duration<__int64,
@@ -158,7 +158,7 @@
return time_point(duration(fp()));
}
-#elif defined(_WIN32)
+#elif defined(_LIBCPP_WIN32API)
steady_clock::time_point
steady_clock::now() _NOEXCEPT