/usr/include/IceUtil/Time.h is in libzeroc-ice-dev 3.7.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | // **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef ICE_UTIL_TIME_H
#define ICE_UTIL_TIME_H
#include <IceUtil/Config.h>
#ifndef _WIN32
# include <sys/time.h>
#endif
namespace IceUtil
{
class ICE_API Time
{
public:
Time();
// No copy constructor and assignment operator necessary. The
// automatically generated copy constructor and assignment
// operator do the right thing.
enum Clock { Realtime, Monotonic };
static Time now(Clock = Realtime);
static Time seconds(Int64);
static Time milliSeconds(Int64);
static Time microSeconds(Int64);
static Time secondsDouble(double);
static Time milliSecondsDouble(double);
static Time microSecondsDouble(double);
#ifndef _WIN32
operator timeval() const;
#endif
Int64 toSeconds() const;
Int64 toMilliSeconds() const;
Int64 toMicroSeconds() const;
double toSecondsDouble() const;
double toMilliSecondsDouble() const;
double toMicroSecondsDouble() const;
std::string toDateTime() const;
std::string toDuration() const;
std::string toString(const std::string&) const;
Time operator-() const
{
return Time(-_usec);
}
Time operator-(const Time& rhs) const
{
return Time(_usec - rhs._usec);
}
Time operator+(const Time& rhs) const
{
return Time(_usec + rhs._usec);
}
Time& operator+=(const Time& rhs)
{
_usec += rhs._usec;
return *this;
}
Time& operator-=(const Time& rhs)
{
_usec -= rhs._usec;
return *this;
}
bool operator<(const Time& rhs) const
{
return _usec < rhs._usec;
}
bool operator<=(const Time& rhs) const
{
return _usec <= rhs._usec;
}
bool operator>(const Time& rhs) const
{
return _usec > rhs._usec;
}
bool operator>=(const Time& rhs) const
{
return _usec >= rhs._usec;
}
bool operator==(const Time& rhs) const
{
return _usec == rhs._usec;
}
bool operator!=(const Time& rhs) const
{
return _usec != rhs._usec;
}
double operator/(const Time& rhs) const
{
return static_cast<double>(_usec) / static_cast<double>(rhs._usec);
}
Time& operator*=(int rhs)
{
_usec *= rhs;
return *this;
}
Time operator*(int rhs) const
{
Time t;
t._usec = _usec * rhs;
return t;
}
Time& operator/=(int rhs)
{
_usec /= rhs;
return *this;
}
Time operator/(int rhs) const
{
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;
}
Time operator/(Int64 rhs) const
{
Time t;
t._usec = _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;
}
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;
}
private:
Time(Int64);
Int64 _usec;
};
ICE_API std::ostream& operator<<(std::ostream&, const Time&);
} // End namespace IceUtil
#endif
|