Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/util/system.cpp b/util/system.cpp
index caf8598b..bf3495dd 100644
--- a/util/system.cpp
+++ b/util/system.cpp
@@ -1,37 +1,46 @@
#include <string>
#include "system.h"
+#include <stdint.h>
#ifndef WINDOWS
#include <unistd.h>
#include <sys/stat.h>
+#include <sys/time.h>
#endif
#ifndef WINDOWS
static bool isReadable(const std::string & path){
if (access(path.c_str(), R_OK) == 0){
return true;
} else {
return false;
}
}
bool System::isDirectory(const std::string & path){
struct stat info;
if (stat(path.c_str(), &info) == 0){
if (S_ISDIR(info.st_mode) == 1){
return true;
} else {
return false;
}
}
return false;
}
bool System::readableFile(const std::string & path){
return isReadable(path) && ! isDirectory(path);
}
bool System::readable(const std::string & path){
return isReadable(path);
}
+
+uint64_t System::currentMicroseconds(){
+ struct timeval hold;
+ gettimeofday(&hold, NULL);
+ return hold.tv_sec * 1000 * 1000 + hold.tv_usec;
+}
+
#endif
diff --git a/util/system.h b/util/system.h
index 499878b8..43a086f0 100644
--- a/util/system.h
+++ b/util/system.h
@@ -1,14 +1,16 @@
#ifndef _paintown_system_h
#define _paintown_system_h
/* system utilities */
#include <string>
+#include <stdint.h>
namespace System{
bool isDirectory(const std::string & path);
bool readableFile(const std::string & path);
bool readable(const std::string & path);
+ uint64_t currentMicroseconds();
}
#endif

File Metadata

Mime Type
text/x-diff
Expires
Thu, Jun 11, 1:29 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
69252
Default Alt Text
(1 KB)

Event Timeline