From 0593891f6cc14ea11b16bc4dec86b0ad132ef986 Mon Sep 17 00:00:00 2001 From: yuangu Date: Sat, 24 Jun 2017 22:57:49 +0800 Subject: [PATCH 1/7] doc for win64 with vs2015 --- docs/quick_start_win32_vs2015.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/quick_start_win32_vs2015.md b/docs/quick_start_win32_vs2015.md index ebd42e27d..d78758c2f 100644 --- a/docs/quick_start_win32_vs2015.md +++ b/docs/quick_start_win32_vs2015.md @@ -9,7 +9,7 @@ Prerequisites: - Visual Studio 2015 Update 3 or - Visual Studio 2017 -- CMake 3.8.0 or higher (note: downloaded automatically if not found) +- CMake 3.8.0 (note: downloaded automatically if not found, but version must be 3.8.2) - git.exe available in your path. You can download and install it from [https://git-for-windows.github.io/] - vcpkg. You can download and install it from [https://github.com/Microsoft/vcpkg]. Commits c5daa93506b616d253e257488ecc385271238e2a tests OK. Following [https://github.com/Microsoft/vcpkg#quick-start](https://github.com/Microsoft/vcpkg#quick-start) to install [vcpkg]. This document assumes that [vcpkg] is installed at `d:\git\vcpkg`. @@ -17,10 +17,19 @@ Prerequisites: Use [vcpkg] to install libevent,glog,gtest,gflags. +##for win_x32: D:\git\vcpkg>vcpkg install gflags D:\git\vcpkg>vcpkg install glog + D:\git\vcpkg>vcpkg install openssl D:\git\vcpkg>vcpkg install libevent-2.x +##for win_x64: + D:\git\vcpkg>vcpkg install gflags:x64-windows + D:\git\vcpkg>vcpkg install glog:x64-windows + D:\git\vcpkg>vcpkg install openssl:x64-windows + D:\git\vcpkg>vcpkg install libevent-2.x:x64-windows + + #### Download the source code of evpp $ git clone https://github.com/Qihoo360/evpp @@ -36,9 +45,16 @@ Using the default vs solution file: Or, we can use CMake to compile the whole projects on WIDNOWS command line console (This does not work on unix shell): +##for win_x32: + D:\360.git\evpp>md build + D:\360.git\evpp>cd build + D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=your_vcpkg_path/vcpkg.cmake -G "Visual Studio 14 2015" .. + D:\360.git\evpp\build>start safe-evpp.sln + +##for win_x64: D:\360.git\evpp>md build D:\360.git\evpp>cd build - D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=D:/git/vcpkg/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 14 2015" .. + D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=your_vcpkg_path/vcpkg.cmake -G "Visual Studio 14 2015 Win64" .. D:\360.git\evpp\build>start safe-evpp.sln #### Run the unit tests @@ -61,3 +77,7 @@ That will install [evpp] in your local machine. And then, you can use [evpp] in [https://git-for-windows.github.io/]:https://git-for-windows.github.io/ + + + + From 2d763d9acced19df6ac7cd27c5d845eff6bc1dda Mon Sep 17 00:00:00 2001 From: yuangu Date: Sat, 24 Jun 2017 23:04:04 +0800 Subject: [PATCH 2/7] update doc --- docs/quick_start_win32_vs2015.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/quick_start_win32_vs2015.md b/docs/quick_start_win32_vs2015.md index d78758c2f..3089f6f30 100644 --- a/docs/quick_start_win32_vs2015.md +++ b/docs/quick_start_win32_vs2015.md @@ -17,13 +17,15 @@ Prerequisites: Use [vcpkg] to install libevent,glog,gtest,gflags. -##for win_x32: +## for win_x32: + D:\git\vcpkg>vcpkg install gflags D:\git\vcpkg>vcpkg install glog D:\git\vcpkg>vcpkg install openssl D:\git\vcpkg>vcpkg install libevent-2.x -##for win_x64: +## for win_x64: + D:\git\vcpkg>vcpkg install gflags:x64-windows D:\git\vcpkg>vcpkg install glog:x64-windows D:\git\vcpkg>vcpkg install openssl:x64-windows @@ -45,13 +47,13 @@ Using the default vs solution file: Or, we can use CMake to compile the whole projects on WIDNOWS command line console (This does not work on unix shell): -##for win_x32: +## for win_x32: D:\360.git\evpp>md build D:\360.git\evpp>cd build D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=your_vcpkg_path/vcpkg.cmake -G "Visual Studio 14 2015" .. D:\360.git\evpp\build>start safe-evpp.sln -##for win_x64: +## for win_x64: D:\360.git\evpp>md build D:\360.git\evpp>cd build D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=your_vcpkg_path/vcpkg.cmake -G "Visual Studio 14 2015 Win64" .. From a7d116dcbfd49a9dc8008f33b16bc353565e86f4 Mon Sep 17 00:00:00 2001 From: yuangu Date: Mon, 26 Jun 2017 07:46:51 +0800 Subject: [PATCH 3/7] Solve Win32 X64 platform, gettimeofday execute slowly --- evpp/gettimeofday.h | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/evpp/gettimeofday.h b/evpp/gettimeofday.h index b6c524e7b..aa36bf9d5 100644 --- a/evpp/gettimeofday.h +++ b/evpp/gettimeofday.h @@ -16,20 +16,31 @@ #ifndef H_GETTIMEOFDAY #define H_GETTIMEOFDAY inline int gettimeofday(struct timeval* tp, void* tzp) { - time_t clock; - struct tm tm; - SYSTEMTIME wtm; - GetLocalTime(&wtm); - tm.tm_year = wtm.wYear - 1900; - tm.tm_mon = wtm.wMonth - 1; - tm.tm_mday = wtm.wDay; - tm.tm_hour = wtm.wHour; - tm.tm_min = wtm.wMinute; - tm.tm_sec = wtm.wSecond; - tm.tm_isdst = -1; - clock = mktime(&tm); - tp->tv_sec = (long)clock; - tp->tv_usec = wtm.wMilliseconds * 1000; + uint64_t intervals; + FILETIME ft; + + GetSystemTimeAsFileTime(&ft); + + /* + * A file time is a 64-bit value that represents the number + * of 100-nanosecond intervals that have elapsed since + * January 1, 1601 12:00 A.M. UTC. + * + * Between January 1, 1970 (Epoch) and January 1, 1601 there were + * 134744 days, + * 11644473600 seconds or + * 11644473600,000,000,0 100-nanosecond intervals. + * + * See also MSKB Q167296. + */ + + intervals = ((uint64_t)ft.dwHighDateTime << 32) | ft.dwLowDateTime; + intervals -= 116444736000000000; + + tp->tv_sec = (long)(intervals / 10000000); + tp->tv_usec = (long)((intervals % 10000000) / 10); + + return (0); } #endif // end of H_GETTIMEOFDAY From 46cad841905a5b44c7348edd1a38ce7aed0b021a Mon Sep 17 00:00:00 2001 From: yuangu Date: Mon, 26 Jun 2017 07:51:19 +0800 Subject: [PATCH 4/7] doc --- docs/quick_start_win32_vs2015.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/quick_start_win32_vs2015.md b/docs/quick_start_win32_vs2015.md index 3089f6f30..aea7c28bf 100644 --- a/docs/quick_start_win32_vs2015.md +++ b/docs/quick_start_win32_vs2015.md @@ -50,13 +50,13 @@ Or, we can use CMake to compile the whole projects on WIDNOWS command line conso ## for win_x32: D:\360.git\evpp>md build D:\360.git\evpp>cd build - D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=your_vcpkg_path/vcpkg.cmake -G "Visual Studio 14 2015" .. + D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=your_vcpkg_path/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 14 2015" .. D:\360.git\evpp\build>start safe-evpp.sln ## for win_x64: D:\360.git\evpp>md build D:\360.git\evpp>cd build - D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=your_vcpkg_path/vcpkg.cmake -G "Visual Studio 14 2015 Win64" .. + D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=your_vcpkg_path/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 14 2015 Win64" .. D:\360.git\evpp\build>start safe-evpp.sln #### Run the unit tests From 2d602dae8a4d36be6c4a24b06389e4912d1376d1 Mon Sep 17 00:00:00 2001 From: yuangu Date: Mon, 26 Jun 2017 07:58:01 +0800 Subject: [PATCH 5/7] Update quick_start_win32_vs2015.md --- docs/quick_start_win32_vs2015.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quick_start_win32_vs2015.md b/docs/quick_start_win32_vs2015.md index aea7c28bf..bf414a5d3 100644 --- a/docs/quick_start_win32_vs2015.md +++ b/docs/quick_start_win32_vs2015.md @@ -9,7 +9,7 @@ Prerequisites: - Visual Studio 2015 Update 3 or - Visual Studio 2017 -- CMake 3.8.0 (note: downloaded automatically if not found, but version must be 3.8.2) +- CMake 3.8.0 (note: downloaded automatically if not found, but version must be 3.8.x) - git.exe available in your path. You can download and install it from [https://git-for-windows.github.io/] - vcpkg. You can download and install it from [https://github.com/Microsoft/vcpkg]. Commits c5daa93506b616d253e257488ecc385271238e2a tests OK. Following [https://github.com/Microsoft/vcpkg#quick-start](https://github.com/Microsoft/vcpkg#quick-start) to install [vcpkg]. This document assumes that [vcpkg] is installed at `d:\git\vcpkg`. From 1b08809a30c96623d9df11a72aad41da0935d468 Mon Sep 17 00:00:00 2001 From: yuangu Date: Mon, 26 Jun 2017 19:38:59 +0800 Subject: [PATCH 6/7] Update quick_start_win32_vs2015.md --- docs/quick_start_win32_vs2015.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/quick_start_win32_vs2015.md b/docs/quick_start_win32_vs2015.md index bf414a5d3..b1531522b 100644 --- a/docs/quick_start_win32_vs2015.md +++ b/docs/quick_start_win32_vs2015.md @@ -17,14 +17,14 @@ Prerequisites: Use [vcpkg] to install libevent,glog,gtest,gflags. -## for win_x32: +##### for win_x32: D:\git\vcpkg>vcpkg install gflags D:\git\vcpkg>vcpkg install glog D:\git\vcpkg>vcpkg install openssl D:\git\vcpkg>vcpkg install libevent-2.x -## for win_x64: +##### for win_x64: D:\git\vcpkg>vcpkg install gflags:x64-windows D:\git\vcpkg>vcpkg install glog:x64-windows @@ -47,13 +47,13 @@ Using the default vs solution file: Or, we can use CMake to compile the whole projects on WIDNOWS command line console (This does not work on unix shell): -## for win_x32: +##### for win_x32: D:\360.git\evpp>md build D:\360.git\evpp>cd build D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=your_vcpkg_path/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 14 2015" .. D:\360.git\evpp\build>start safe-evpp.sln -## for win_x64: +##### for win_x64: D:\360.git\evpp>md build D:\360.git\evpp>cd build D:\360.git\evpp\build>cmake -DCMAKE_TOOLCHAIN_FILE=your_vcpkg_path/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 14 2015 Win64" .. From 29e6bc2065b8cd3d947fda9abc582a63d2c1fedc Mon Sep 17 00:00:00 2001 From: yuangu Date: Mon, 26 Jun 2017 19:46:00 +0800 Subject: [PATCH 7/7] update docs --- ...t_win32_vs2015.md => quick_start_windows_with_visualstudio.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{quick_start_win32_vs2015.md => quick_start_windows_with_visualstudio.md} (100%) diff --git a/docs/quick_start_win32_vs2015.md b/docs/quick_start_windows_with_visualstudio.md similarity index 100% rename from docs/quick_start_win32_vs2015.md rename to docs/quick_start_windows_with_visualstudio.md