]> git.stg.codes - stg.git/blobdiff - stglibs/common.lib/include/stg/common.h
Merge branch 'stg-2.409' into stg-2.409-radius
[stg.git] / stglibs / common.lib / include / stg / common.h
index f46c922aedf6a85be7423b00c0a97285af40f064..d404e013a824332976699956b036392f701d579b 100644 (file)
 #ifndef common_h
 #define common_h
 
-#ifdef __BORLANDC__
-#include <time.h>
-#else
-#include <ctime>
-#endif
+#include "stg/os_int.h"
+#include "stg/const.h"
+
 #include <string>
 #include <sstream>
+#include <ctime>
+#include <climits> // NAME_MAX
 
-#include "stg/os_int.h"
-#include "stg/const.h"
+#include <unistd.h> // uid_t, gid_t
+#include <sys/stat.h> // mode_t
 
 #define STAT_TIME_3         (1)
 #define STAT_TIME_2         (2)
@@ -149,9 +149,12 @@ bool WriteAll(int sd, const void * source, size_t size);
 
 std::string ToPrintable(const std::string & src);
 
+std::string formatTime(time_t value);
+time_t readTime(const std::string & value);
 //-----------------------------------------------------------------------------
 int str2x(const std::string & str, int32_t & x);
 int str2x(const std::string & str, uint32_t & x);
+int str2x(const std::string & str, double & x);
 #ifndef WIN32
 int str2x(const std::string & str, int64_t & x);
 int str2x(const std::string & str, uint64_t & x);
@@ -299,4 +302,8 @@ const std::string & unsigned2str(varT x, std::string & s)
 char * stg_strptime(const char *, const char *, struct tm *);
 time_t stg_timegm(struct tm *);
 
+uid_t str2uid(const std::string& name);
+gid_t str2gid(const std::string& name);
+mode_t str2mode(const std::string& mode);
+
 #endif