47 gettimeofday(¤t, 0);
49 (long) current.tv_sec * 1000L + (
long) current.tv_usec / 1000L;
52 LARGE_INTEGER val, val2;
53 BOOL check = QueryPerformanceCounter(&val);
54 check = QueryPerformanceFrequency(&val2);
55 return (
long)(val.QuadPart * 1000 / val2.QuadPart);
72 STARTUPINFO StartupInfo;
73 PROCESS_INFORMATION ProcessInfo;
76 memset(&StartupInfo, 0,
sizeof(StartupInfo));
77 StartupInfo.cb =
sizeof(STARTUPINFO);
78 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
79 StartupInfo.wShowWindow = SW_HIDE;
83 char* args =
new char[winCmd.size() + 1];
85 strcpy(args, winCmd.c_str());
86 if (!CreateProcess(
nullptr, args,
nullptr,
nullptr, FALSE,
87 CREATE_NEW_CONSOLE,
nullptr,
nullptr, &StartupInfo, &ProcessInfo)) {
89 return (
unsigned long)GetLastError();
92 WaitForSingleObject(ProcessInfo.hProcess,
INFINITE);
93 if (!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) {
97 CloseHandle(ProcessInfo.hThread);
98 CloseHandle(ProcessInfo.hProcess);
103 return (
unsigned long)system(cmd.c_str());