summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/IceUtil/Time.h102
1 files changed, 77 insertions, 25 deletions
diff --git a/cpp/include/IceUtil/Time.h b/cpp/include/IceUtil/Time.h
index bff307bd12c..12ae6d31f52 100644
--- a/cpp/include/IceUtil/Time.h
+++ b/cpp/include/IceUtil/Time.h
@@ -42,112 +42,164 @@ public:
std::string toString() const;
- Time operator-() const // Inlined for performance reasons.
+ Time operator-() const
{
return Time(-_usec);
}
- Time operator-(const Time& rhs) const // Inlined for performance reasons.
+ Time operator-(const Time& rhs) const
{
return Time(_usec - rhs._usec);
}
- Time operator+(const Time& rhs) const // Inlined for performance reasons.
+ Time operator+(const Time& rhs) const
{
return Time(_usec + rhs._usec);
}
- Time& operator+=(const Time& rhs) // Inlined for performance reasons.
+ Time& operator+=(const Time& rhs)
{
_usec += rhs._usec;
return *this;
}
- Time& operator-=(const Time& rhs) // Inlined for performance reasons.
+ Time& operator-=(const Time& rhs)
{
_usec -= rhs._usec;
return *this;
}
- bool operator<(const Time& rhs) const // Inlined for performance reasons.
+ bool operator<(const Time& rhs) const
{
return _usec < rhs._usec;
}
- bool operator<=(const Time& rhs) const // Inlined for performance reasons.
+ bool operator<=(const Time& rhs) const
{
return _usec <= rhs._usec;
}
- bool operator>(const Time& rhs) const // Inlined for performance reasons.
+ bool operator>(const Time& rhs) const
{
return _usec > rhs._usec;
}
- bool operator>=(const Time& rhs) const // Inlined for performance reasons.
+ bool operator>=(const Time& rhs) const
{
return _usec >= rhs._usec;
}
- bool operator==(const Time& rhs) const // Inlined for performance reasons.
+ bool operator==(const Time& rhs) const
{
return _usec == rhs._usec;
}
- bool operator!=(const Time& rhs) const // Inlined for performance reasons.
+ bool operator!=(const Time& rhs) const
{
return _usec != rhs._usec;
}
- template<typename T> Time& operator*=(T rhs)
+ Time& operator*=(const Time& rhs)
{
- _usec *= rhs;
+ _usec *= rhs._usec;
return *this;
}
- Time& operator*=(const Time& rhs)
+ Time operator*(const Time& rhs) const
{
- _usec *= rhs._usec;
+ Time t;
+ t._usec = _usec * rhs._usec;
+ return t;
+ }
+
+ Time& operator/=(const Time& rhs)
+ {
+ _usec /= rhs._usec;
return *this;
}
- template<typename T> Time operator*(T rhs) const
+ Time operator/(const Time& rhs) const
{
Time t;
- t._usec = _usec * rhs;
+ t._usec = _usec / rhs._usec;
return t;
}
- Time operator*(const Time& rhs) const
+ Time& operator*=(int rhs)
+ {
+ _usec *= rhs;
+ return *this;
+ }
+
+ Time operator*(int rhs) const
{
Time t;
- t._usec = _usec * rhs._usec;
+ t._usec = _usec * rhs;
return t;
}
- template<typename T> Time& operator/=(T rhs)
+ Time& operator/=(int rhs)
{
_usec /= rhs;
return *this;
}
- Time& operator/=(const Time& rhs)
+ Time operator/(int rhs) const
{
- _usec /= rhs._usec;
+ Time t;
+ t._usec = _usec / rhs;
+ return t;
+ }
+
+ Time& operator*=(Int64 rhs)
+ {
+ _usec *= rhs;
+ return *this;
+ }
+
+ Time operator*(Int64 rhs) const
+ {
+ Time t;
+ t._usec = _usec * rhs;
+ return t;
+ }
+
+ Time& operator/=(Int64 rhs)
+ {
+ _usec /= rhs;
return *this;
}
- template<typename T> Time operator/(T rhs) const
+ Time operator/(Int64 rhs) const
{
Time t;
t._usec = _usec / rhs;
return t;
}
- Time operator/(const Time& rhs) const
+ Time& operator*=(double rhs)
+ {
+ _usec = static_cast<Int64>(static_cast<double>(_usec) * rhs);
+ return *this;
+ }
+
+ Time operator*(double rhs) const
{
Time t;
- t._usec = _usec / rhs._usec;
+ t._usec = static_cast<Int64>(static_cast<double>(_usec) * rhs);
+ return t;
+ }
+
+ Time& operator/=(double rhs)
+ {
+ _usec = static_cast<Int64>(static_cast<double>(_usec) / rhs);
+ return *this;
+ }
+
+ Time operator/(double rhs) const
+ {
+ Time t;
+ t._usec = static_cast<Int64>(static_cast<double>(_usec) / rhs);
return t;
}