Subject: Re: [boost] [date_time] Patch for ticket #1740: date_time includes <windows.h>
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-10-14 12:13:52
Jeff Garland <jeff_at_[hidden]> writes:
> joaquin_at_[hidden] wrote:
>> Jeff Garland escribió:
>>> Emil Mieilica wrote:
>>>> Done. Hope it will be useful to everybody who uses this great library.
>>>>> Can you attach this patch to the ticket so it doesn't get lost?
>>> Just a technical comment on the suggested patch. Is it really wise
>>> / legal to
>>> replicate the Windows API declarations in Boost.
>> Isn't that exactly what other libs such as WINE do? See
> Yeah, I guess they would have to since they are an emulation of the
> Win32 api. AFAIK we've never taken this approach in Boost so I think
> we should talk thru if it's acceptable before putting it in. If it is
> acceptable, I guess the other question might be if it belongs in
> config instead of an individual library.
boost/detail/lwm_win32_cs.hpp does this for CRITICAL_SECTION, and
boost/thread/win32/thread_primitives.hpp does this for some APIs.
In both cases the structures and APIs are redeclared in a nested
namespace in boost, so as not to clash with the declarations in the
global namespace should someone include <windows.h> outside the boost
I've attached the patch I've been using locally. The "filetime.hpp"
goes in boost/date_time.
-- Anthony Williams | Just Software Solutions Ltd Custom Software Development | http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL
// (C) Copyright 2008 Anthony Williams
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
typedef FILETIME file_time;
typedef SYSTEMTIME system_time;
unsigned long dwLowDateTime;
unsigned long dwHighDateTime;
unsigned short wYear;
unsigned short wMonth;
unsigned short wDayOfWeek;
unsigned short wDay;
unsigned short wHour;
unsigned short wMinute;
unsigned short wSecond;
unsigned short wMilliseconds;
__declspec(dllimport) void __stdcall GetSystemTimeAsFileTime(file_time*);
__declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const file_time*,file_time*);
__declspec(dllimport) void __stdcall GetSystemTime(system_time*);
__declspec(dllimport) int __stdcall SystemTimeToFileTime(const system_time*,file_time*);
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk