{
protected:
// UNIX Time Value
- unix_time_type m_time;
+ unix_time_type m_unixtime;
public:
// Constructor
- unix_time(){ m_time = get_unix_time_now(); }
- unix_time(const unix_time_type& tm) : m_time(tm) {}
+ unix_time(){ m_unixtime = get_unix_time_now(); }
+ unix_time(const unix_time_type& tm) : m_unixtime(tm) {}
// Accessors
- unix_time_type get() const { return m_time; }
- unix_time_type get_time() const { return m_time; }
- unix_time_type to_time() const { return m_time; }
- void set(const unix_time_type& tm) { m_time = tm; }
- void set_time(const unix_time_type& tm) { m_time = tm; }
+ unix_time_type get() const { return m_unixtime; }
+ unix_time_type get_time() const { return m_unixtime; }
+ unix_time_type to_time() const { return m_unixtime; }
+ void set(const unix_time_type& tm) { m_unixtime = tm; }
+ void set_time(const unix_time_type& tm) { m_unixtime = tm; }
// Time Values
int get_second() const { return m_unixtime % 60; }
// To String
::std::string to_string() const {
- return ::ctime(&m_time);
+ return ::ctime(&m_unixtime);
}
// To struct tm
struct ::tm to_struct_tm() const { return to_struct_tm_local(); }
- struct ::tm to_struct_tm_gmt() const { return *(::gmtime(&m_time)); }
- struct ::tm to_struct_tm_local() const { return *(::localtime(&m_time)); }
+ struct ::tm to_struct_tm_gmt() const { return *(::gmtime(&m_unixtime)); }
+ struct ::tm to_struct_tm_local() const { return *(::localtime(&m_unixtime)); }
// Operators
- operator unix_time_type() const { return m_time; }
+ operator unix_time_type() const { return m_unixtime; }
};
typedef unix_time unixtime;