49 gettimeofday(¤t, 0);
51 (long) current.tv_sec * 1000L + (
long) current.tv_usec / 1000L;
54 LARGE_INTEGER val, val2;
55 BOOL check = QueryPerformanceCounter(&val);
56 check = QueryPerformanceFrequency(&val2);
57 return (
long)(val.QuadPart * 1000 / val2.QuadPart);
64 SysUtils::getWindowsTicks() {
65 return (
long) GetTickCount();
74 STARTUPINFO StartupInfo;
75 PROCESS_INFORMATION ProcessInfo;
78 memset(&StartupInfo, 0,
sizeof(StartupInfo));
79 StartupInfo.cb =
sizeof(STARTUPINFO);
80 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
81 StartupInfo.wShowWindow = SW_HIDE;
84 std::string winCmd =
"CMD.exe /c " + cmd;
85 char* args =
new char[winCmd.size()];
87 strcpy(args, winCmd.c_str());
88 if (!CreateProcess(NULL, args, NULL, NULL, FALSE,
89 CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) {
91 return (
unsigned long)GetLastError();
94 WaitForSingleObject(ProcessInfo.hProcess,
INFINITE);
95 if (!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) {
99 CloseHandle(ProcessInfo.hThread);
100 CloseHandle(ProcessInfo.hProcess);
105 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.