00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <OPENR/OTime.h>
00023
00024 OTime::OTime()
00025 {
00026 clock_ = 0;
00027 timeDif_ = 0;
00028 }
00029
00030 OTime::OTime(time_t clock, sbyte timeDif)
00031 {
00032 clock_ = clock;
00033 timeDif_ = timeDif;
00034 }
00035
00036 OTime::OTime(const OTime& time)
00037 {
00038 *this = time;
00039 }
00040
00041 OTime& OTime::operator=(const OTime& time)
00042 {
00043 clock_ = time.clock_;
00044 timeDif_ = time.timeDif_;
00045 return *this;
00046 }
00047
00048 bool OTime::operator<(const OTime& time) const
00049 {
00050 return (clock_ < time.clock_);
00051 }
00052
00053 bool OTime::operator<=(const OTime& time) const
00054 {
00055 return (clock_ <= time.clock_);
00056 }
00057
00058 bool OTime::operator>(const OTime& time) const
00059 {
00060 return (clock_ > time.clock_);
00061 }
00062
00063 bool OTime::operator>=(const OTime& time) const
00064 {
00065 return (clock_ >= time.clock_);
00066 }
00067
00068 bool OTime::operator==(const OTime& time) const
00069 {
00070 return (clock_ == time.clock_);
00071 }
00072
00073 OStatus OTime::Set(time_t clock, sbyte timeDif)
00074 {
00075 clock_ = clock;
00076 timeDif_ = timeDif;
00077 return oSUCCESS;
00078 }
00079
00080 OStatus OTime::SetClock(time_t clock)
00081 {
00082 clock_ = clock;
00083 return oSUCCESS;
00084 }
00085
00086 OStatus OTime::SetLocalTime(time_t localTime)
00087 {
00088 clock_ = localTime - (timeDif_ * 3600);
00089 return oSUCCESS;
00090 }
00091
00092 OStatus OTime::SetTimeDif(sbyte timeDif)
00093 {
00094 timeDif_ = timeDif;
00095 return oSUCCESS;
00096 }
00097
00098 time_t OTime::GetClock() const
00099 {
00100 return clock_;
00101 }
00102
00103 time_t OTime::GetLocalTime() const
00104 {
00105
00106 return clock_ + (timeDif_ * 3600);
00107 }
00108
00109 sbyte OTime::GetTimeDif() const
00110 {
00111 return timeDif_;
00112 }