42 gettimeofday(¤t, 0);
44 (long) current.tv_sec * 1000
L + (
long) current.tv_usec / 1000
L;
47 LARGE_INTEGER val, val2;
48 BOOL check = QueryPerformanceCounter(&val);
49 check = QueryPerformanceFrequency(&val2);
50 return (
long)(val.QuadPart * 1000 / val2.QuadPart);
57 SysUtils::getWindowsTicks() {
58 return (
long) GetTickCount();
67 STARTUPINFO StartupInfo;
68 PROCESS_INFORMATION ProcessInfo;
71 memset(&StartupInfo, 0,
sizeof(StartupInfo));
72 StartupInfo.cb =
sizeof(STARTUPINFO);
73 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
74 StartupInfo.wShowWindow = SW_HIDE;
77 std::string winCmd =
"CMD.exe /c " + cmd;
78 char* args =
new char[winCmd.size() + 1];
80 strcpy(args, winCmd.c_str());
81 if (!CreateProcess(
nullptr, args,
nullptr,
nullptr, FALSE,
82 CREATE_NEW_CONSOLE,
nullptr,
nullptr, &StartupInfo, &ProcessInfo)) {
84 return (
unsigned long)GetLastError();
87 WaitForSingleObject(ProcessInfo.hProcess,
INFINITE);
88 if (!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) {
92 CloseHandle(ProcessInfo.hThread);
93 CloseHandle(ProcessInfo.hProcess);
98 return (
unsigned long)system(cmd.c_str());
static unsigned long runHiddenCommand(const std::string &cmd)
run a shell command without popping up any windows (particuarly on win32)
static long getCurrentMillis()
Returns the current time in milliseconds.