48 gettimeofday(¤t, 0);
50 (long) current.tv_sec * 1000L + (
long) current.tv_usec / 1000L;
53 LARGE_INTEGER val, val2;
54 BOOL check = QueryPerformanceCounter(&val);
55 check = QueryPerformanceFrequency(&val2);
56 return (
long)(val.QuadPart * 1000 / val2.QuadPart);
63 SysUtils::getWindowsTicks() {
64 return (
long) GetTickCount();
73 STARTUPINFO StartupInfo;
74 PROCESS_INFORMATION ProcessInfo;
77 memset(&StartupInfo, 0,
sizeof(StartupInfo));
78 StartupInfo.cb =
sizeof(STARTUPINFO);
79 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
80 StartupInfo.wShowWindow = SW_HIDE;
83 std::string winCmd =
"CMD.exe /c " + cmd;
84 char* args =
new char[winCmd.size() + 1];
86 strcpy(args, winCmd.c_str());
87 if (!CreateProcess(NULL, args, NULL, NULL, FALSE,
88 CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) {
90 return (
unsigned long)GetLastError();
93 WaitForSingleObject(ProcessInfo.hProcess,
INFINITE);
94 if (!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) {
98 CloseHandle(ProcessInfo.hThread);
99 CloseHandle(ProcessInfo.hProcess);
104 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.