return ret.str();
}
-DTime::DTime()
-{
-// set(); // saves lots of gettimeofday calls
- d_set.tv_sec=d_set.tv_usec=0;
-}
-
-time_t DTime::time()
-{
- return d_set.tv_sec;
-}
-
const string unquotify(const string &item)
{
if(item.size()<2)
class DTime
{
public:
- DTime(); //!< Does not set the timer for you! Saves lots of gettimeofday() calls
+ //!< Does not set the timer for you! Saves lots of gettimeofday() calls
+ DTime() = default;
DTime(const DTime &dt) = default;
DTime & operator=(const DTime &dt) = default;
- time_t time();
+ inline time_t time() const;
inline void set(); //!< Reset the timer
inline int udiff(bool reset = true); //!< Return the number of microseconds since the timer was last set.
{
d_set=tv;
}
- struct timeval getTimeval()
+ struct timeval getTimeval() const
{
return d_set;
}
private:
- struct timeval d_set;
+struct timeval d_set{0, 0};
};
+inline time_t DTime::time() const
+{
+ return d_set.tv_sec;
+}
+
inline void DTime::set()
{
- gettimeofday(&d_set,0);
+ gettimeofday(&d_set, nullptr);
}
inline int DTime::udiff(bool reset)
{
struct timeval now;
- gettimeofday(&now,0);
+ gettimeofday(&now, nullptr);
int ret=1000000*(now.tv_sec-d_set.tv_sec)+(now.tv_usec-d_set.tv_usec);