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();
77 return (
unsigned long)system(cmd.c_str());
80 STARTUPINFO StartupInfo;
81 PROCESS_INFORMATION ProcessInfo;
84 memset(&StartupInfo, 0,
sizeof(StartupInfo));
85 StartupInfo.cb =
sizeof(STARTUPINFO);
86 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
87 StartupInfo.wShowWindow = SW_HIDE;
90 std::string winCmd =
"CMD.exe /c " + cmd;
91 char* args =
new char[winCmd.size()];
93 strcpy(args, winCmd.c_str());
94 if (!CreateProcess(NULL, args, NULL, NULL, FALSE,
95 CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) {
97 return (
unsigned long)GetLastError();
100 WaitForSingleObject(ProcessInfo.hProcess,
INFINITE);
101 if (!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) {
105 CloseHandle(ProcessInfo.hThread);
106 CloseHandle(ProcessInfo.hProcess);
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.