[date_time] WinCE patch for microsec_time_clock.hpp

Just a small patch for the date_time library. WinCE does not supply the GetSystemTimeAsFileTime Win32 method. It does however supply the individual GetSystemTime and SystemTimeToFileTime methods. The config headers already define BOOST_NO_GETSYSTEMTIMEASFILETIME to flag this situation and the patch uses this define to mark when the alternate function calls should be substituted. Thanks, -Dave Index: microsec_time_clock.hpp =================================================================== --- microsec_time_clock.hpp (revision 40672) +++ microsec_time_clock.hpp (working copy) @@ -120,6 +120,10 @@ FILETIME ft_utc; GetSystemTimeAsFileTime(&ft_utc); FileTimeToLocalFileTime(&ft_utc,&ft); + #elif defined(BOOST_NO_GETSYSTEMTIMEASFILETIME) + SYSTEMTIME st; + GetSystemTime( &st ); + SystemTimeToFileTime( &st, &ft ); #else GetSystemTimeAsFileTime(&ft); #endif @@ -134,6 +138,10 @@ FILETIME ft_utc; GetSystemTimeAsFileTime(&ft_utc); FileTimeToLocalFileTime(&ft_utc,&ft); + #elif defined(BOOST_NO_GETSYSTEMTIMEASFILETIME) + SYSTEMTIME st; + GetSystemTime( &st ); + SystemTimeToFileTime( &st, &ft ); #else GetSystemTimeAsFileTime(&ft); #endif

David Deakins wrote:
Just a small patch for the date_time library. WinCE does not supply the GetSystemTimeAsFileTime Win32 method. It does however supply the individual GetSystemTime and SystemTimeToFileTime methods. The config headers already define BOOST_NO_GETSYSTEMTIMEASFILETIME to flag this situation and the patch uses this define to mark when the alternate function calls should be substituted.
Same comment as for Boost.System. Wouldn't it be better to rely on _WIN32_WCE to enable the workaround? Thanks, --Beman

Beman Dawes wrote:
David Deakins wrote:
The config headers already define BOOST_NO_GETSYSTEMTIMEASFILETIME to flag this situation and the patch uses this define to mark when the alternate function calls should be substituted.
Same comment as for Boost.System. Wouldn't it be better to rely on _WIN32_WCE to enable the workaround?
In general I have been bracketing these sorts of workarounds with the #if defined(UNDER_CE) statement, but in those two cases there appeared to be pre-existing macros (BOOST_NO_GETSYSTEMTIMEASFILETIME in boost\config\compiler\visualc.hpp and BOOST_NO_ANSI_APIS in boost\config\platform\win32.hpp). I believe both were originally introduced to support Boost.Threads and came about some time ago. I personally have no preference though, and can certainly recast the WinCE patches not to use them or to use an alternate macro name. Just let me know where the consensus lies and I'll move that direction. Thanks, -Dave

David Deakins wrote:
Beman Dawes wrote:
David Deakins wrote:
The config headers already define BOOST_NO_GETSYSTEMTIMEASFILETIME to flag this situation and the patch uses this define to mark when the alternate function calls should be substituted. Same comment as for Boost.System. Wouldn't it be better to rely on _WIN32_WCE to enable the workaround?
In general I have been bracketing these sorts of workarounds with the #if defined(UNDER_CE) statement, but in those two cases there appeared to be pre-existing macros (BOOST_NO_GETSYSTEMTIMEASFILETIME in boost\config\compiler\visualc.hpp and BOOST_NO_ANSI_APIS in boost\config\platform\win32.hpp). I believe both were originally introduced to support Boost.Threads and came about some time ago. I personally have no preference though, and can certainly recast the WinCE patches not to use them or to use an alternate macro name. Just let me know where the consensus lies and I'll move that direction.
I didn't realize BOOST_NO_ANSI_APIS came from config. Ignore my comment. Your patch is fine as submitted. Thanks, --Beman

David Deakins wrote:
Just a small patch for the date_time library. WinCE does not supply the GetSystemTimeAsFileTime Win32 method. It does however supply the individual GetSystemTime and SystemTimeToFileTime methods. The config headers already define BOOST_NO_GETSYSTEMTIMEASFILETIME to flag this situation and the patch uses this define to mark when the alternate function calls should be substituted.
Just wanted to make sure that this patch doesn't fall off the radar. Since Boost.Threads depends on DateTime, I can't fully verify that the WinCE-related fixes allow its regression tests to pass until this patch is in place. Thanks, -Dave
participants (2)
-
Beman Dawes
-
David Deakins