41 #ifdef CHECK_MEMORY_LEAKS 43 #endif // CHECK_MEMORY_LEAKS 53 gettimeofday(¤t, 0);
55 (long) current.tv_sec * 1000L + (
long) current.tv_usec / 1000L;
58 LARGE_INTEGER val, val2;
59 BOOL check = QueryPerformanceCounter(&val);
60 check = QueryPerformanceFrequency(&val2);
61 return (
long)(val.QuadPart * 1000 / val2.QuadPart);
68 SysUtils::getWindowsTicks() {
69 return (
long) GetTickCount();
78 STARTUPINFO StartupInfo;
79 PROCESS_INFORMATION ProcessInfo;
82 memset(&StartupInfo, 0,
sizeof(StartupInfo));
83 StartupInfo.cb =
sizeof(STARTUPINFO);
84 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
85 StartupInfo.wShowWindow = SW_HIDE;
88 std::string winCmd =
"CMD.exe /c " + cmd;
89 char* args =
new char[winCmd.size()];
91 strcpy(args, winCmd.c_str());
92 if (!CreateProcess(NULL, args, NULL, NULL, FALSE,
93 CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) {
95 return (
unsigned long)GetLastError();
98 WaitForSingleObject(ProcessInfo.hProcess,
INFINITE);
99 if (!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) {
103 CloseHandle(ProcessInfo.hThread);
104 CloseHandle(ProcessInfo.hProcess);
109 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.