- fixes for Windows build
This commit is contained in:
parent
978079fd55
commit
fa053324fa
|
|
@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.15)
|
|||
project (helper_lib)
|
||||
|
||||
# Rely on C++ 11
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (CMAKE_CXX_STANDARD 20)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
option (USE_NULL_UUID "When enabled linking to libuuid is avoided" OFF)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ std::string OsProcess::execCommand(const std::string& cmd)
|
|||
PROCESS_INFORMATION pi = { 0 };
|
||||
|
||||
char* cmdline = (char*)_alloca(cmd.size()+1);
|
||||
strcpy(cmdline, StringHelper::replace(cmd, "/", "\\").c_str());
|
||||
strcpy(cmdline, strx::replace(cmd, "/", "\\").c_str());
|
||||
|
||||
BOOL fSuccess = CreateProcessA( nullptr, cmdline, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi);
|
||||
if (! fSuccess)
|
||||
|
|
@ -114,7 +114,7 @@ std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdl
|
|||
memset(&pi, 0, sizeof pi);
|
||||
|
||||
char* cmdbuffer = (char*)_alloca(cmdline.size()+1);
|
||||
strcpy(cmdbuffer, StringHelper::replace(cmdline, "/", "\\").c_str());
|
||||
strcpy(cmdbuffer, strx::replace(cmdline, "/", "\\").c_str());
|
||||
|
||||
|
||||
BOOL fSuccess = CreateProcessA( nullptr, cmdbuffer, nullptr, nullptr, TRUE,
|
||||
|
|
@ -160,14 +160,14 @@ std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdl
|
|||
{
|
||||
std::string line(buf, cr - buf -1);
|
||||
if (callback)
|
||||
callback(StringHelper::trim(line));
|
||||
callback(strx::trim(line));
|
||||
memmove(buf, cr + 1, strlen(cr+1) + 1);
|
||||
}
|
||||
}
|
||||
} //for
|
||||
|
||||
if (buf[0])
|
||||
callback(StringHelper::trim(std::string(buf)));
|
||||
callback(strx::trim(std::string(buf)));
|
||||
|
||||
char ctrlc = 3;
|
||||
//if (finish_flag)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,17 @@
|
|||
#include "HL_Time.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include <chrono>
|
||||
/* return current time in milliseconds */
|
||||
double now_ms(void) {
|
||||
double now_ms(void)
|
||||
{
|
||||
#if defined(TARGET_WIN)
|
||||
auto tp = std::chrono::steady_clock::now();
|
||||
auto result = std::chrono::duration_cast<std::chrono::milliseconds>(tp.time_since_epoch()).count();
|
||||
return result;
|
||||
#else
|
||||
struct timespec res;
|
||||
clock_gettime(CLOCK_MONOTONIC, &res);
|
||||
return 1000.0 * res.tv_sec + (double) res.tv_nsec / 1e6;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 34425a748bcad9235b58f97da25577947c501844
|
||||
Subproject commit 0a786d3a7a49057ba31bf82a91269819f713c985
|
||||
Loading…
Reference in New Issue