Index: boost/chrono/detail/inlined/win/chrono.hpp =================================================================== --- boost/chrono/detail/inlined/win/chrono.hpp (revision 69227) +++ boost/chrono/detail/inlined/win/chrono.hpp (working copy) @@ -95,7 +95,14 @@ system_clock::time_point system_clock::now() { boost::detail::win32::FILETIME_ ft; - boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails + #if defined(UNDER_CE) + // Windows CE does not define GetSystemTimeAsFileTime so we do it in two steps. + boost::detail::win32::SYSTEMTIME_ st; + boost::detail::win32::GetSystemTime( &st ); + boost::detail::win32::SystemTimeToFileTime( &st, &ft ); + #else + boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails + #endif return system_clock::time_point(system_clock::duration( (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)); } @@ -104,7 +111,14 @@ system_clock::time_point system_clock::now( system::error_code & ec ) { boost::detail::win32::FILETIME_ ft; - boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails + #if defined(UNDER_CE) + // Windows CE does not define GetSystemTimeAsFileTime so we do it in two steps. + boost::detail::win32::SYSTEMTIME_ st; + boost::detail::win32::GetSystemTime( &st ); + boost::detail::win32::SystemTimeToFileTime( &st, &ft ); + #else + boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails + #endif if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); Index: boost/chrono/detail/inlined/win/process_clock.hpp =================================================================== --- boost/chrono/detail/inlined/win/process_clock.hpp (revision 69226) +++ boost/chrono/detail/inlined/win/process_clock.hpp (working copy) @@ -34,6 +34,11 @@ times_.real = duration( steady_clock::now().time_since_epoch().count() ); + #ifdef UNDER_CE + // Windows CE does not support GetProcessTimes + assert( 0 && "GetProcessTimes not supported under Windows CE" ); + times_.real = times_.system = times_.user = nanoseconds(-1); + #else if ( boost::detail::win32::GetProcessTimes( boost::detail::win32::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) @@ -67,7 +72,7 @@ times_.real = times_.system = times_.user = nanoseconds(-1); } } - + #endif } } // namespace chrono } // namespace boost Index: boost/chrono/detail/inlined/win/process_cpu_clocks.hpp =================================================================== --- boost/chrono/detail/inlined/win/process_cpu_clocks.hpp (revision 69226) +++ boost/chrono/detail/inlined/win/process_cpu_clocks.hpp (working copy) @@ -33,6 +33,11 @@ // note that Windows uses 100 nanosecond ticks for FILETIME boost::detail::win32::FILETIME_ creation, exit, user_time, system_time; + #ifdef UNDER_CE + // Windows CE does not support GetProcessTimes + assert( 0 && "GetProcessTimes not supported under Windows CE" ); + return time_point(); + #else if ( boost::detail::win32::GetProcessTimes( boost::detail::win32::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) @@ -60,6 +65,7 @@ return time_point(); } } + #endif } process_user_cpu_clock::time_point process_user_cpu_clock::now( @@ -69,6 +75,11 @@ // note that Windows uses 100 nanosecond ticks for FILETIME boost::detail::win32::FILETIME_ creation, exit, user_time, system_time; + #ifdef UNDER_CE + // Windows CE does not support GetProcessTimes + assert( 0 && "GetProcessTimes not supported under Windows CE" ); + return time_point(); + #else if ( boost::detail::win32::GetProcessTimes( boost::detail::win32::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) @@ -99,6 +110,7 @@ return time_point(); } } + #endif } process_system_cpu_clock::time_point process_system_cpu_clock::now( @@ -108,6 +120,11 @@ // note that Windows uses 100 nanosecond ticks for FILETIME boost::detail::win32::FILETIME_ creation, exit, user_time, system_time; + #ifdef UNDER_CE + // Windows CE does not support GetProcessTimes + assert( 0 && "GetProcessTimes not supported under Windows CE" ); + return time_point(); + #else if ( boost::detail::win32::GetProcessTimes( boost::detail::win32::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) @@ -138,7 +155,8 @@ return time_point(); } } - + #endif + } process_cpu_clock::time_point process_cpu_clock::now( system::error_code & ec ) @@ -147,6 +165,11 @@ // note that Windows uses 100 nanosecond ticks for FILETIME boost::detail::win32::FILETIME_ creation, exit, user_time, system_time; + #ifdef UNDER_CE + // Windows CE does not support GetProcessTimes + assert( 0 && "GetProcessTimes not supported under Windows CE" ); + return time_point(); + #else if ( boost::detail::win32::GetProcessTimes( boost::detail::win32::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) @@ -183,6 +206,7 @@ return time_point(); } } + #endif } } // namespace chrono Index: boost/detail/win/GetCurrentThread.hpp =================================================================== --- boost/detail/win/GetCurrentThread.hpp (revision 69226) +++ boost/detail/win/GetCurrentThread.hpp (working copy) @@ -14,11 +14,19 @@ namespace boost { namespace detail { namespace win32 { +#if defined( UNDER_CE ) +// Windows CE define GetCurrentThread as an inline function in kfuncs.h +inline HANDLE_ GetCurrentThread() +{ + return ::GetCurrentThread(); +} +#else #if defined( BOOST_USE_WINDOWS_H ) using ::GetCurrentThread; #else extern "C" __declspec(dllimport) HANDLE_ WINAPI GetCurrentThread(); #endif +#endif } } } Index: boost/detail/win/GetProcessTimes.hpp =================================================================== --- boost/detail/win/GetProcessTimes.hpp (revision 69226) +++ boost/detail/win/GetProcessTimes.hpp (working copy) @@ -14,6 +14,7 @@ namespace boost { namespace detail { namespace win32 { +#if !defined(UNDER_CE) // Windows CE does not define GetProcessTimes #if defined( BOOST_USE_WINDOWS_H ) using ::GetProcessTimes; #else @@ -26,6 +27,7 @@ LPFILETIME_ lpUserTime ); #endif +#endif } } } Index: boost/detail/win/time.hpp =================================================================== --- boost/detail/win/time.hpp (revision 69226) +++ boost/detail/win/time.hpp (working copy) @@ -23,7 +23,9 @@ typedef SYSTEMTIME SYSTEMTIME_; typedef SYSTEMTIME* PSYSTEMTIME_; + #ifndef UNDER_CE // Windows CE does not define GetSystemTimeAsFileTime using ::GetSystemTimeAsFileTime; + #endif using ::FileTimeToLocalFileTime; using ::GetSystemTime; using ::SystemTimeToFileTime; @@ -47,8 +49,10 @@ WORD_ wMilliseconds; } SYSTEMTIME_, *PSYSTEMTIME_; + #ifndef UNDER_CE // Windows CE does not define GetSystemTimeAsFileTime __declspec(dllimport) void WINAPI GetSystemTimeAsFileTime(FILETIME_* lpFileTime); + #endif __declspec(dllimport) int WINAPI FileTimeToLocalFileTime(const FILETIME_* lpFileTime, FILETIME_* lpLocalFileTime); Index: libs/chrono/example/chrono_unit_test.cpp =================================================================== --- libs/chrono/example/chrono_unit_test.cpp (revision 69226) +++ libs/chrono/example/chrono_unit_test.cpp (working copy) @@ -23,9 +23,17 @@ std::time_t sys_time = boost::chrono::system_clock::to_time_t(boost::chrono::system_clock::now()); + #ifdef UNDER_CE + // Windows CE does not define asctime() + struct tm * t = std::gmtime(&sys_time); std::cout << "system_clock::to_time_t(system_clock::now()) is " + << t->tm_mon << "/" << t->tm_mday << "/" << (1900 + t->tm_year) << " " << t->tm_hour << ":" << t->tm_min << ":" << t->tm_sec << std::endl; + #else + std::cout + << "system_clock::to_time_t(system_clock::now()) is " << std::asctime(std::gmtime(&sys_time)) << std::endl; + #endif return 0; } Index: libs/chrono/example/runtime_resolution.cpp =================================================================== --- libs/chrono/example/runtime_resolution.cpp (revision 69226) +++ libs/chrono/example/runtime_resolution.cpp (working copy) @@ -42,15 +42,25 @@ namespace { - //struct timeval { - // long tv_sec; /* seconds */ - // long tv_usec; /* and microseconds */ - //}; + #ifdef UNDER_CE + // Windows CE does not define timeval + struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ + }; + #endif int gettimeofday(struct timeval * tp, void *) { FILETIME ft; - ::GetSystemTimeAsFileTime( &ft ); // never fails + #if defined(UNDER_CE) + // Windows CE does not define GetSystemTimeAsFileTime so we do it in two steps. + SYSTEMTIME st; + ::GetSystemTime( &st ); + ::SystemTimeToFileTime( &st, &ft ); + #else + ::GetSystemTimeAsFileTime( &ft ); // never fails + #endif long long t = (static_cast(ft.dwHighDateTime) << 32) | ft.dwLowDateTime; # if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0 t -= 116444736000000000LL; @@ -92,7 +102,7 @@ : rep_(static_cast(d.count() * ticks_per_nanosecond)) {} // explicit - operator tonanosec() const {return tonanosec(rep_/ticks_per_nanosecond);} + tonanosec convert_to_nanosec() const {return tonanosec(rep_/ticks_per_nanosecond);} // observer @@ -218,7 +228,7 @@ clock::duration elapsed = stop - start; std::cout << "paused " << boost::chrono::nanoseconds( - boost::chrono::duration_cast(duration::tonanosec(elapsed))).count() + boost::chrono::duration_cast( elapsed.convert_to_nanosec() )).count() << " nanoseconds\n"; } Index: libs/chrono/example/timeval_demo.cpp =================================================================== --- libs/chrono/example/timeval_demo.cpp (revision 69226) +++ libs/chrono/example/timeval_demo.cpp (working copy) @@ -44,15 +44,25 @@ namespace { - //struct timeval { - // long tv_sec; /* seconds */ - // long tv_usec; /* and microseconds */ - //}; + #ifdef UNDER_CE + // Windows CE does not define timeval + struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ + }; + #endif int gettimeofday(struct timeval * tp, void *) { FILETIME ft; - ::GetSystemTimeAsFileTime( &ft ); // never fails + #if defined(UNDER_CE) + // Windows CE does not define GetSystemTimeAsFileTime so we do it in two steps. + SYSTEMTIME st; + ::GetSystemTime( &st ); + ::SystemTimeToFileTime( &st, &ft ); + #else + ::GetSystemTimeAsFileTime( &ft ); // never fails + #endif long long t = (static_cast(ft.dwHighDateTime) << 32) | ft.dwLowDateTime; # if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0 t -= 116444736000000000LL;