From 9ed05fa7300331431e81b317c43ae51e8d156423 Mon Sep 17 00:00:00 2001 From: Davis King Date: Thu, 29 Jan 2015 17:51:18 -0500 Subject: [PATCH 1/3] Made the timestamper use timeGetTime() instead of GetTickCount() on windows since timeGetTime() is more accurate. --- dlib/CMakeLists.txt | 4 ++-- dlib/misc_api/misc_api_kernel_1.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt index 1ca8d4f07..f14cf9f65 100644 --- a/dlib/CMakeLists.txt +++ b/dlib/CMakeLists.txt @@ -136,9 +136,9 @@ if (NOT TARGET dlib) # we want to link to the right stuff depending on our platform. if (WIN32 AND NOT CYGWIN) ############################################################################### if (DLIB_NO_GUI_SUPPORT) - set (dlib_needed_libraries ws2_32) + set (dlib_needed_libraries ws2_32 winmm) else() - set (dlib_needed_libraries ws2_32 comctl32 gdi32 imm32) + set (dlib_needed_libraries ws2_32 winmm comctl32 gdi32 imm32) endif() elseif(APPLE) ############################################################################ find_library(pthreadlib pthread) diff --git a/dlib/misc_api/misc_api_kernel_1.cpp b/dlib/misc_api/misc_api_kernel_1.cpp index 9ca509453..773579180 100644 --- a/dlib/misc_api/misc_api_kernel_1.cpp +++ b/dlib/misc_api/misc_api_kernel_1.cpp @@ -13,6 +13,11 @@ #include "../windows_magic.h" #include +// tell visual studio to link to the library needed to call timeGetTime() +#ifdef _MSC_VER +#pragma comment (lib, "winmm.lib") +#endif + #ifdef __BORLANDC__ // Apparently the borland compiler doesn't define this. #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) @@ -89,7 +94,7 @@ namespace dlib get_timestamp ( ) const { - unsigned long temp = GetTickCount(); + unsigned long temp = timeGetTime(); if (temp >= last_time) { last_time = temp; From c4eaf67c65e61da98d24238187796cccd455f2e4 Mon Sep 17 00:00:00 2001 From: Davis King Date: Thu, 29 Jan 2015 17:52:58 -0500 Subject: [PATCH 2/3] updated docs --- docs/docs/compile.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/compile.xml b/docs/docs/compile.xml index ae6f1d5da..62774ccc6 100644 --- a/docs/docs/compile.xml +++ b/docs/docs/compile.xml @@ -97,7 +97,7 @@ sudo apt-get install libx11-dev

Compiling on Windows Using GCC

The commands for gcc on windows are the same as above but you may also have to link - (via the -l option) to the following libraries: gdi32, comctl32, user32, ws2_32, or imm32. + (via the -l option) to the following libraries: gdi32, comctl32, user32, winmm, ws2_32, or imm32. However, it's worth pointing out that Visual Studio Express is free and a much better choice for windows development than gcc.

From e5dec25dfb39e3d67b20cfcd9583d68326b2b9cc Mon Sep 17 00:00:00 2001 From: Davis King Date: Thu, 29 Jan 2015 17:54:57 -0500 Subject: [PATCH 3/3] Fixed missing const on statement::bind() --- dlib/sqlite/sqlite.h | 12 ++++++------ dlib/sqlite/sqlite_abstract.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dlib/sqlite/sqlite.h b/dlib/sqlite/sqlite.h index c08ec2545..dcd9e1198 100644 --- a/dlib/sqlite/sqlite.h +++ b/dlib/sqlite/sqlite.h @@ -383,7 +383,7 @@ namespace dlib template typename enable_if_c::is_integer>::type bind ( unsigned long idx, - T& item + const T& item ) { if (sizeof(T) <= 4) @@ -392,15 +392,15 @@ namespace dlib bind_int64(idx, item); } - void bind(unsigned long idx, std::string& item) { bind_text(idx, item); } - void bind(unsigned long idx, float& item ) { bind_double(idx, item); } - void bind(unsigned long idx, double& item ) { bind_double(idx, item); } - void bind(unsigned long idx, long double& item) { bind_double(idx, item); } + void bind(unsigned long idx, const std::string& item) { bind_text(idx, item); } + void bind(unsigned long idx, const float& item ) { bind_double(idx, item); } + void bind(unsigned long idx, const double& item ) { bind_double(idx, item); } + void bind(unsigned long idx, const long double& item) { bind_double(idx, item); } template typename disable_if_c::is_integer>::type bind ( unsigned long idx, - T& item + const T& item ) { bind_object(idx, item); diff --git a/dlib/sqlite/sqlite_abstract.h b/dlib/sqlite/sqlite_abstract.h index b378e1329..7372162d8 100644 --- a/dlib/sqlite/sqlite_abstract.h +++ b/dlib/sqlite/sqlite_abstract.h @@ -379,7 +379,7 @@ namespace dlib > void bind ( unsigned long parameter_id, - T& item + const T& item ) const; /*! requires