50 gettimeofday(¤t, 0);
52 (long) current.tv_sec * 1000L + (
long) current.tv_usec / 1000L;
55 LARGE_INTEGER val, val2;
56 BOOL check = QueryPerformanceCounter(&val);
57 check = QueryPerformanceFrequency(&val2);
58 return (
long)(val.QuadPart * 1000 / val2.QuadPart);
65SysUtils::getWindowsTicks() {
66 return (
long) GetTickCount();
75 STARTUPINFO StartupInfo;
76 PROCESS_INFORMATION ProcessInfo;
79 memset(&StartupInfo, 0,
sizeof(StartupInfo));
80 StartupInfo.cb =
sizeof(STARTUPINFO);
81 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
82 StartupInfo.wShowWindow = SW_HIDE;
85 std::string winCmd =
"CMD.exe /c " + cmd;
86 char* args =
new char[winCmd.size() + 1];
88 strcpy(args, winCmd.c_str());
89 if (!CreateProcess(
nullptr, args,
nullptr,
nullptr, FALSE,
90 CREATE_NEW_CONSOLE,
nullptr,
nullptr, &StartupInfo, &ProcessInfo)) {
92 return (
unsigned long)GetLastError();
95 WaitForSingleObject(ProcessInfo.hProcess,
INFINITE);
96 if (!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) {
100 CloseHandle(ProcessInfo.hThread);
101 CloseHandle(ProcessInfo.hProcess);
106 return (
unsigned long)system(cmd.c_str());
114 if (stat(fname.c_str(), &result) == 0) {
115 return result.st_mtime;
static unsigned long runHiddenCommand(const std::string &cmd)
run a shell command without popping up any windows (particuarly on win32)
static long long getModifiedTime(const std::string &fname)
static long getCurrentMillis()
Returns the current time in milliseconds.