# this patch was created by willem jan hengeveld - itsme@xs4all.nl
diff -duwrN xxx\boost_1_35_0\boost\thread\thread_time.hpp boost_1_35_0\boost\thread\thread_time.hpp
--- xxx\boost_1_35_0\boost\thread\thread_time.hpp	Sun Nov 25 21:07:19 2007
+++ boost_1_35_0\boost\thread\thread_time.hpp	Fri Apr 25 13:34:09 2008
@@ -5,12 +5,14 @@
 //  Distributed under the Boost Software License, Version 1.0. (See
 //  accompanying file LICENSE_1_0.txt or copy at
 //  http://www.boost.org/LICENSE_1_0.txt)
-
+#ifndef BOOST_THREAD_NO_DATETIME
 #include <boost/date_time/microsec_time_clock.hpp>
 #include <boost/date_time/posix_time/posix_time_types.hpp>
+#endif
 
 namespace boost
 {
+#ifndef BOOST_THREAD_NO_DATETIME
     typedef boost::posix_time::ptime system_time;
     
     inline system_time get_system_time()
@@ -40,7 +42,64 @@
         }
 
     }
+#else
+    class system_time {
+    private:
+            int _t;
+    public:
+        system_time() : _t(-1) { }
+        system_time(const system_time& t) : _t(t._t) { }
+        system_time(int t) : _t(t) { }
+        static system_time positive_infinity() 
+        {
+            return system_time(-1);
+        }
+        bool is_pos_infinity() const { return _t==-1; }
+        system_time operator-(const system_time& rhs) const
+        {
+            system_time lhs(_t);
+            lhs._t -= rhs._t;
+            return lhs;
+        }
+        bool operator<=(const system_time& rhs) const
+        {
+            return _t<=rhs._t;
+        }
+        int total_milliseconds() const
+        {
+            return _t;
+        }
+    };
+    
+    extern "C" int GetTickCount();
+    inline system_time get_system_time()
+    {
+        return GetTickCount();
+    }
+
+    namespace detail
+    {
+        inline system_time get_system_time_sentinel()
+        {
+            return system_time::positive_infinity();
+        }
+
+        inline unsigned long get_milliseconds_until(system_time const& target_time)
+        {
+            if (target_time.is_pos_infinity())
+                return ~(unsigned long)0;
     
+            system_time const now=get_system_time();
+            if(target_time<=now)
+            {
+                return 0;
+            }
+            return static_cast<unsigned long>((target_time-now).total_milliseconds()+1);
+        }
+
+    }
+
+#endif
 }
 
 #endif
diff -duwrN xxx\boost_1_35_0\boost\thread\xtime.hpp boost_1_35_0\boost\thread\xtime.hpp
--- xxx\boost_1_35_0\boost\thread\xtime.hpp	Sun Nov 25 21:07:19 2007
+++ boost_1_35_0\boost\thread\xtime.hpp	Fri Apr 25 13:29:10 2008
@@ -12,7 +12,9 @@
 
 #include <boost/cstdint.hpp>
 #include <boost/thread/thread_time.hpp>
+#ifndef BOOST_THREAD_NO_DATETIME
 #include <boost/date_time/posix_time/conversion.hpp>
+#endif
 
 namespace boost {
 
@@ -43,6 +45,7 @@
 
     operator system_time() const
     {
+#ifndef BOOST_THREAD_NO_DATETIME
         return boost::posix_time::from_time_t(0)+
             boost::posix_time::seconds(static_cast<long>(sec))+
 #ifdef BOOST_DATE_TIME_HAS_NANOSECONDS
@@ -50,6 +53,9 @@
 #else
         boost::posix_time::microseconds((nsec+500)/1000);
 #endif
+#else
+        return system_time(sec*1000+(nsec+500000)/1000000);
+#endif
     }
     
 };
@@ -57,10 +63,15 @@
 inline xtime get_xtime(boost::system_time const& abs_time)
 {
     xtime res={0};
+#ifndef BOOST_THREAD_NO_DATETIME
     boost::posix_time::time_duration const time_since_epoch=abs_time-boost::posix_time::from_time_t(0);
             
     res.sec=static_cast<xtime::xtime_sec_t>(time_since_epoch.total_seconds());
     res.nsec=static_cast<xtime::xtime_nsec_t>(time_since_epoch.fractional_seconds()*(1000000000/time_since_epoch.ticks_per_second()));
+#else
+    res.sec= abs_time.total_milliseconds()/1000;
+    res.nsec= (abs_time.total_milliseconds()%1000)*1000000;
+#endif
     return res;
 }
 
diff -duwrN xxx\boost_1_35_0\libs\thread\src\win32\thread.cpp boost_1_35_0\libs\thread\src\win32\thread.cpp
--- xxx\boost_1_35_0\libs\thread\src\win32\thread.cpp	Fri Dec 21 14:51:05 2007
+++ boost_1_35_0\libs\thread\src\win32\thread.cpp	Fri Apr 25 13:40:51 2008
@@ -18,7 +18,9 @@
 #include <boost/thread/tss.hpp>
 #include <boost/assert.hpp>
 #include <boost/thread/detail/tss_hooks.hpp>
+#ifndef BOOST_THREAD_NO_DATETIME
 #include <boost/date_time/posix_time/conversion.hpp>
+#endif
 
 namespace boost
 {
@@ -299,7 +301,7 @@
         detail::thread_data_ptr local_thread_info=get_thread_info();
         if(local_thread_info)
         {
-            if(!this_thread::interruptible_wait(local_thread_info->thread_handle,get_milliseconds_until(wait_until)))
+            if(!this_thread::interruptible_wait(local_thread_info->thread_handle,::boost::detail::get_milliseconds_until(wait_until)))
             {
                 return false;
             }
@@ -373,6 +375,7 @@
                 }
                 else
                 {
+#ifndef BOOST_THREAD_NO_DATETIME
                     SYSTEMTIME target_system_time={0};
                     target_system_time.wYear=target_time.abs_time.date().year();
                     target_system_time.wMonth=target_time.abs_time.date().month();
@@ -390,6 +393,7 @@
                         long const hundred_nanoseconds_in_one_second=10000000;
                         due_time.QuadPart+=target_time.abs_time.time_of_day().fractional_seconds()*(hundred_nanoseconds_in_one_second/target_time.abs_time.time_of_day().ticks_per_second());
                     }
+#endif
                 }
                 return due_time;
             }
diff -duwrN xxx\boost_1_35_0\tools\build\v2\user-config.jam boost_1_35_0\tools\build\v2\user-config.jam
--- xxx\boost_1_35_0\tools\build\v2\user-config.jam	Thu Nov 15 19:31:06 2007
+++ boost_1_35_0\tools\build\v2\user-config.jam	Fri Apr 25 14:55:39 2008
@@ -51,7 +51,16 @@
 
 #  Configure msvc (default version, searched in standard location
 #  and PATH).
-#  using msvc ;
+#
+#  see http://www.boost.org/boost-build2/doc/html/bbv2/reference/tools.html#bbv2.reference.tools.compiler.msvc
+#    http://www.boost.org/doc/libs/1_35_0/more/getting_started/windows.html
+using msvc  : : : 
+    <compiler>"$(PROGRAMFILES)/Microsoft Visual Studio 8/VC/ce/bin/x86_arm/cl.exe"
+    <compileflags>"-DARM -D_ARM_ -DARMV4 -DUNICODE -D_UNICODE -DNDEBUG -D_CRT_SECURE_NO_WARNINGS -D_SECURE_SCL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_WIN32_WCE=501 -DWIN32_PLATFORM_PSPC -DUNDER_CE=501 -DBOOST_THREAD_NO_DATETIME"
+    <linker>"$(PROGRAMFILES)/Microsoft Visual Studio 8/VC/ce/bin/x86_arm/link.exe"
+    <linkflags>"/machine:arm /subsystem:windowsce coredll.lib corelibc.lib ccrtrtti.lib secchk.lib"
+    <setup>"my_vcvars_arm.bat"
+;
 
 #  Borland configuration
 #  using borland ;

diff -duwrN xxx\boost_1_35_0\libs\thread\src\win32\tss_pe.cpp boost_1_35_0\libs\thread\src\win32\tss_pe.cpp
--- xxx\boost_1_35_0\libs\thread\src\win32\tss_pe.cpp	Fri Mar 21 18:04:10 2008
+++ boost_1_35_0\libs\thread\src\win32\tss_pe.cpp	Fri Apr 25 14:59:04 2008
@@ -264,6 +264,9 @@
         longer needed and can be removed.
         */
     }
-#endif //defined(_MSC_VER) && !defined(UNDER_CE)
-
+#elif defined(UNDER_CE)
+    extern "C" void tss_cleanup_implemented(void)
+    {
+    }
+#endif
 #endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB)
diff -duwrN xxx\boost_1_35_0\mksome.bat boost_1_35_0\mksome.bat
--- xxx\boost_1_35_0\mksome.bat	Thu Jan 01 02:00:00 1970
+++ boost_1_35_0\mksome.bat	Fri Apr 25 14:15:58 2008
@@ -0,0 +1,3 @@
+bjam link=static --build-dir=build-arm --with-thread --toolset=msvc stage
+copy /Y stage\lib\libboost_thread-vc80-mt.lib lib-arm\libboost_thread-vc80-mt-s-1_35.lib
+rd stage build-arm /s/q
diff -duwrN xxx\boost_1_35_0\my_vcvars_arm.bat boost_1_35_0\my_vcvars_arm.bat
--- xxx\boost_1_35_0\my_vcvars_arm.bat	Thu Jan 01 02:00:00 1970
+++ boost_1_35_0\my_vcvars_arm.bat	Fri Apr 25 14:06:08 2008
@@ -0,0 +1,45 @@
+@echo off
+if "%VStudNet%"=="" (
+    SET VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio 8
+    SET VCINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio 8\VC
+) else (
+    SET VSINSTALLDIR=%VStudNet%
+    SET VCINSTALLDIR=%VStudNet%\VC
+)
+SET FrameworkDir=%WINDIR%\Microsoft.NET\Framework
+SET FrameworkVersion=v2.0.50727
+SET FrameworkSDKDir=%VSINSTALLDIR%\SDK\v2.0
+
+if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
+if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR
+
+echo Setting environment for using Microsoft Visual Studio 2005 PocketPC 2003 ARM tools.
+
+rem
+
+rem Root of Visual Studio IDE installed files.
+rem
+set DevEnvDir=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
+
+cl /v 2>&1 | %WINDIR%\system32\findstr /E "for ARM"
+if errorlevel 1 set PATH=%VCINSTALLDIR%\ce\bin\x86_arm;%VCINSTALLDIR%\bin;%VCINSTALLDIR%\PlatformSDK\bin;%VSINSTALLDIR%\Common7\Tools;%VSINSTALLDIR%\Common7\IDE;%VSINSTALLDIR%\Common\Tools;%VSINSTALLDIR%\Common\IDE;%VSINSTALLDIR%;%FrameworkSDKDir%\Bin;%PATH%
+
+set INCLUDE=%VCINSTALLDIR%\ce\include;%VSINSTALLDIR%\SmartDevices\SDK\PocketPC2003\include;%VCINSTALLDIR%\ce\atlmfc\include;%VSINSTALLDIR%\SmartDevices\SDK\SQL Server\Mobile\v3.0
+set LIB=%VSINSTALLDIR%\SmartDevices\SDK\PocketPC2003\lib\ARMV4;%VCINSTALLDIR%\ce\atlmfc\lib\ARMV4;%VCINSTALLDIR%\ce\lib\ARMV4
+set LIBPATH=%VCINSTALLDIR%\ce\atlmfc\src\atl\;%VCINSTALLDIR%\ce\atlmfc\src\mfc\;%VCINSTALLDIR%\ce\crt\src
+
+goto end
+
+:error_no_VSINSTALLDIR
+echo ERROR: VSINSTALLDIR variable is not set. 
+goto end
+
+:error_no_VCINSTALLDIR
+echo ERROR: VCINSTALLDIR variable is not set. 
+
+goto end
+
+:end
+


