]> git.tdb.fi Git - libs/core.git/blobdiff - source/time/timedelta.h
Add move semantics to Variant
[libs/core.git] / source / time / timedelta.h
index a6c7005b9a35639875e36d85cc6d5b97ed169b5c..2ff4bdd9d4b18a2c5f1c19980c105c87bc75149f 100644 (file)
@@ -20,11 +20,11 @@ private:
 
 public:
        /** Constructs a zero TimeDelta. */
-       TimeDelta() = default;
+       constexpr TimeDelta() = default;
 
        /** Constructs a TimeDelta from a plain number.  The purpose of this is to
        allow serialization together with the raw() function. */
-       explicit TimeDelta(RawTime u): usec(u) { }
+       explicit constexpr TimeDelta(RawTime u): usec(u) { }
 
        /** Returns the raw number stored inside the TimeDelta.  This should only be used
        for serialization and the result should not be interpreted in any way. */
@@ -65,14 +65,14 @@ MSPCORE_API void operator<<(LexicalConverter &, const TimeDelta &);
 
 
 // Constants to be used in creation of TimeDeltas
-MSPCORE_API extern const TimeDelta zero;
-MSPCORE_API extern const TimeDelta usec;
-MSPCORE_API extern const TimeDelta msec;
-MSPCORE_API extern const TimeDelta sec;
-MSPCORE_API extern const TimeDelta min;
-MSPCORE_API extern const TimeDelta hour;
-MSPCORE_API extern const TimeDelta day;
-MSPCORE_API extern const TimeDelta week;
+constexpr TimeDelta zero(0);
+constexpr TimeDelta usec(1);
+constexpr TimeDelta msec(1000);
+constexpr TimeDelta sec(1000000);
+constexpr TimeDelta min(60*1000000);
+constexpr TimeDelta hour(3600*1000000LL);
+constexpr TimeDelta day(86400*1000000LL);
+constexpr TimeDelta week(7*86400*1000000LL);
 
 inline TimeDelta abs(const TimeDelta &t) { return t>=zero ? t : -t; }
 using std::abs;