class D2Time {
public:
D2Time (const double seconds = 0.0) { this->seconds = seconds; }
D2Time (const std::time_t time) { this->seconds = double(time - TimeDifference); }
D2Time (const D2Time& time) { this->seconds = time.seconds; }
void setSeconds (const double seconds) { this->seconds = seconds; }
double getSeconds () const { return this->seconds; }
void setTime (const std::time_t time) { this->seconds = double (time - TimeDifference); }
std::time_t getTime () const { return std::time_t (this->seconds) + TimeDifference; }
static D2Time now () { return D2Time (std::time(NULL)); }
private:
double seconds;
static const std::time_t TimeDifference = (1972 - 1970) * 365 * 24 * 3600;
};
0 komentárov