24 #include <sys/types.h>
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);
62 SysUtils::getWindowsTicks() {
63 return (
long) GetTickCount();
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());
111 if (stat(fname.c_str(), &result) == 0) {
112 return result.st_mtime;
static std::string transcodeToLocal(const std::string &utf8String)
convert a string from UTF-8 to the local codepage
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)
@brie get modified time
static long getCurrentMillis()
Returns the current time in milliseconds.