Time.h

Go to the documentation of this file.
00001 /*
00002  * See the dyninst/COPYRIGHT file for copyright information.
00003  * 
00004  * We provide the Paradyn Tools (below described as "Paradyn")
00005  * on an AS IS basis, and do not warrant its validity or performance.
00006  * We reserve the right to update, modify, or discontinue this
00007  * software at any time.  We shall have no obligation to supply such
00008  * updates or modifications or any other form of support to you.
00009  * 
00010  * By your use of Paradyn, you understand and agree that we (or any
00011  * other person or entity with proprietary rights in Paradyn) are
00012  * under no obligation to provide either maintenance services,
00013  * update services, notices of latent defects, or correction of
00014  * defects for Paradyn.
00015  * 
00016  * This library is free software; you can redistribute it and/or
00017  * modify it under the terms of the GNU Lesser General Public
00018  * License as published by the Free Software Foundation; either
00019  * version 2.1 of the License, or (at your option) any later version.
00020  * 
00021  * This library is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00024  * Lesser General Public License for more details.
00025  * 
00026  * You should have received a copy of the GNU Lesser General Public
00027  * License along with this library; if not, write to the Free Software
00028  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00029  */
00030 
00031 #ifndef __TIME_H
00032 #define __TIME_H
00033 
00034 #include <assert.h>
00035 #include "common/h/Types.h"
00036 #include "common/h/fraction.h"
00037 
00038 /* These user classes that are defined:
00039    timeUnit  - eg. microsecond, minute, year
00040                size: 32 bytes
00041    timeBase  - represents the time that a timeStamp is based from  (eg. 1970)
00042                size: 8 bytes
00043    timeStamp - represents a point in time, ie. a length of time from a timeBase
00044                size: 8 bytes
00045    timeLength- represents a length of time
00046                size: 8 bytes
00047 */
00048 
00049 // timeUnit ---------------------------------------------------
00050 
00051 // A timeUnit represents a unit of time and thus consists of a ratio of how
00052 // many nanoseconds (the standard unit decided upon) per unit of the
00053 // represented time unit.  The timeUnit class is used by the timeStamp and
00054 // timeLength classes for converting the represented base to (via
00055 // ns_per_unit) and from (via units_per_ns) nanoseconds.
00056 
00057 class timeUnit {
00058  private:
00059   // logically const
00060    COMMON_EXPORT static const timeUnit *_leapYear;
00061    COMMON_EXPORT static const timeUnit *_year;
00062    COMMON_EXPORT static const timeUnit *_day;
00063    COMMON_EXPORT static const timeUnit *_hour;
00064    COMMON_EXPORT static const timeUnit *_minute;
00065    COMMON_EXPORT static const timeUnit *_sec;
00066    COMMON_EXPORT static const timeUnit *_ms;
00067    COMMON_EXPORT static const timeUnit *_us;
00068    COMMON_EXPORT static const timeUnit *_ns;
00069    COMMON_EXPORT static const timeUnit *nsHelp();
00070    COMMON_EXPORT static const timeUnit *usHelp();
00071    COMMON_EXPORT static const timeUnit *msHelp();
00072    COMMON_EXPORT static const timeUnit *secHelp();
00073    COMMON_EXPORT static const timeUnit *minHelp();
00074    COMMON_EXPORT static const timeUnit *hourHelp();
00075    COMMON_EXPORT static const timeUnit *dayHelp();
00076    COMMON_EXPORT static const timeUnit *yearHelp();
00077    COMMON_EXPORT static const timeUnit *leapYearHelp();
00078  public:
00079    COMMON_EXPORT static const timeUnit &ns();
00080    COMMON_EXPORT static const timeUnit &us();
00081    COMMON_EXPORT static const timeUnit &ms();
00082    COMMON_EXPORT static const timeUnit &sec();
00083    COMMON_EXPORT static const timeUnit &minute();
00084    COMMON_EXPORT static const timeUnit &hour();
00085    COMMON_EXPORT static const timeUnit &day();
00086    COMMON_EXPORT static const timeUnit &year();
00087    COMMON_EXPORT static const timeUnit &leapYear();
00088 
00089  public:
00090   typedef enum { sparse, verbose } ostream_fmt; 
00091    static ostream_fmt curFmt;
00092 
00093  private:
00094   fraction ns_per_unit;
00095   fraction units_per_ns;
00096 
00097  public:
00098    COMMON_EXPORT timeUnit(fraction _ns_per_unit);
00099   // default copy constructor
00100 
00101   // Selectors
00102    COMMON_EXPORT fraction get_ns_per_unit()  const;
00103    COMMON_EXPORT fraction get_units_per_ns() const;
00104 
00105   // Mutators
00106    COMMON_EXPORT void set_ns_per_unit(const fraction &nspu);
00107    COMMON_EXPORT int64_t cvtTo_ns(double  units) const;
00108    COMMON_EXPORT int64_t cvtTo_ns(int64_t units) const;
00109    COMMON_EXPORT double  cvtFrom_nsD(int64_t ns) const;
00110    COMMON_EXPORT int64_t cvtFrom_nsI(int64_t ns) const;
00111 };
00112 
00113 COMMON_EXPORT ostream& operator<<(ostream&s, const timeUnit::ostream_fmt &u);
00114 COMMON_EXPORT ostream& operator<<(ostream&s, const timeUnit &u);
00115 
00116 class timeStamp;
00117 
00118 // timeBase ---------------------------------------------------
00119 
00120 // Represents the starting time that a timeStamp time is from.  For example
00121 // time from gettimeofday has a time base of 1970.  I have set up these
00122 // constant time bases:
00123 // b1970: represents Jan 1, 12:00:00am 1970
00124 // bStd:  represents Jan 1, 12:00:00am 2000
00125 // bNone: no base, sometimes want timeStamp that has no time base as in
00126 //        process times.  eg. for process time we care only about the length
00127 //        of the time not so much the start time (ie. base)
00128 
00129 // A timeBase is stored as number of nanoseconds from the represented (start)
00130 // time to bStd (ie. Jan 1, 12:00:00am 2000).  This class also provides
00131 // functions that convert nanoseconds to and from the represented time base
00132 // and the standard time base (bStd).  No this is not the base class of any
00133 // of timeParent, timeStamp, timeLength.  Sorry for any confusion.
00134 
00135 class timeBase {
00136  private:
00137   // change internal time base to 2100 in the year 2050
00138   COMMON_EXPORT static const timeBase *_b1970;  // logically const
00139   COMMON_EXPORT static const timeBase *_bStd;
00140   COMMON_EXPORT static const timeBase *bStdHelp();
00141   COMMON_EXPORT static const timeBase *b1970Help();
00142  public:
00143   // ie. the year for the internal time base, if changed check to make
00144   // sure timeBase::b1970Help() is still accurate
00145   enum { StdBaseMark = 2000 };  
00146   COMMON_EXPORT static const timeBase &bStd();
00147   COMMON_EXPORT static const timeBase &b1970();
00148   // bNone is for times like process time, time is counted since the
00149   // start of the process representing the process time in regards to
00150   // a real time base (not unit) as in b1970 doesn't make sense
00151   COMMON_EXPORT static const timeBase &bNone();
00152 
00153  private:
00154   int64_t ns2StdBaseMark;  
00155 
00156  public:
00157   //Paradyn default base: from nearest century turnover
00158 
00159   COMMON_EXPORT timeBase(int64_t ns2stdMark);
00160   COMMON_EXPORT timeBase(timeStamp mark);  // defined inline below
00161   COMMON_EXPORT int64_t get_ns2StdBaseMark() const;
00162   COMMON_EXPORT int64_t cvtTo_bStd(int64_t ns) const;
00163   COMMON_EXPORT double  cvtFrom_bStd(double ns) const;
00164   COMMON_EXPORT int64_t cvtFrom_bStd(int64_t ns) const;
00165 };
00166 
00167 COMMON_EXPORT ostream& operator<<(ostream&s, timeBase b);
00168 
00169 // Responsibilities:
00170 //   - store time in a standard unit and time base, currently this is:
00171 //        * standard unit:      nanoseconds
00172 //        * standard time base: Jan 1, 12:00:00am 2000
00173 
00174 // an abstract class
00175 class timeParent {
00176  private:
00177   COMMON_EXPORT static const int64_t uninitializedValue;
00178   int64_t ns;
00179 
00180   // Constructors
00181  public:
00182   // Selectors
00183   COMMON_EXPORT int64_t get_ns() const;
00184 
00185   // returns true if the timeStamp is uninitialized
00186   COMMON_EXPORT bool isInitialized() const;
00187 
00188   // the disadvantage of having a timeParent operator<< via the help
00189   // of this virtual put function is that it causes a pointer to the vtable
00190   // to be carried around with all of our timeLengths and timeStamps
00191   // and they become less lightweight
00192   //  virtual ostream& put(ostream& s) const = 0;  // write *this to s
00193 
00194  protected:
00195   COMMON_EXPORT timeParent();
00196   COMMON_EXPORT timeParent(int64_t _ns);
00197   // Mutators
00198   COMMON_EXPORT void assign(const int64_t v);
00199   COMMON_EXPORT int64_t getRolloverTime(double t);
00200 };
00201 
00202 //ostream& operator<<(ostream& s, const timeParent &tp);
00203 
00204 class timeLength;
00205 
00206 // timeStamp ---------------------------------------------------
00207 
00208 // A timeStamp represents a point in time.  To do this it stores the number
00209 // of nanoseconds since the standard time base (Jan 1, 2000).  It provides a
00210 // generic method of storing time.  It is based on a 64bit signed integer so
00211 // it can represent any time at nanosecond granularity between year 2000 +-
00212 // 292 years (ie. 1708-2292).
00213 
00214 class timeStamp : public timeParent {
00215  private:
00216   COMMON_EXPORT static const timeStamp *_ts1800;
00217   COMMON_EXPORT static const timeStamp *_ts1970;
00218   COMMON_EXPORT static const timeStamp *_tsStd;  // ie. timeBase::InternalTimeBase (2000)
00219   COMMON_EXPORT static const timeStamp *_ts2200;
00220   COMMON_EXPORT static const timeStamp *ts1800Help();
00221   COMMON_EXPORT static const timeStamp *ts1970Help();
00222   COMMON_EXPORT static const timeStamp *tsStdHelp();
00223   COMMON_EXPORT static const timeStamp *ts2200Help();
00224  public:
00225   COMMON_EXPORT static const timeStamp &ts1800();
00226   COMMON_EXPORT static const timeStamp &ts1970();
00227   COMMON_EXPORT static const timeStamp &tsStd();
00228   COMMON_EXPORT static const timeStamp &ts2200();
00229   COMMON_EXPORT static const timeStamp &tsLongAgoTime();
00230   COMMON_EXPORT static const timeStamp &tsFarOffTime();
00231 
00232   // need this constructor to use in vector container class
00233   // value set to a "weird" value to represent uninitialized
00234   COMMON_EXPORT timeStamp();
00235   // eg. to create the time Jan 1, 1995 12:00am you could do this:
00236   //    timeStamp myTime(25, timeUnit::year(), timeBase::b1970());
00237   // one way to create July 20, 1976 8:35am:
00238   //    timeStamp myBirthDay = timeStamp::b1970() + 4*timeLength::year() +
00239   //                           2*timeStamp::leapYear() +
00240   //                           202*timeLength::day() + 8*timeLength::hour() +
00241   //                           35*timeLength::min();  
00242   COMMON_EXPORT timeStamp(int64_t iTime, const timeUnit &u, timeBase b);
00243   COMMON_EXPORT timeStamp(int iTime, const timeUnit &u, timeBase b);
00244   COMMON_EXPORT timeStamp(const timeLength &tl, timeBase b);
00245   COMMON_EXPORT timeStamp(double dTime, const timeUnit &u, timeBase b);
00246 
00247   // Selectors
00248   COMMON_EXPORT double getD(const timeUnit &u, timeBase b) const;
00249   // eg. to get the number of seconds since 1970 do this: 
00250   //        ts.getI(timeUnit::sec(), timeBase::b1970()) 
00251   COMMON_EXPORT int64_t getI(const timeUnit &u, timeBase b) const;
00252 
00253   // ostream& put(ostream& s) const { return s << *this; }
00254 
00255   friend COMMON_EXPORT const timeStamp operator+=(timeStamp &ts, timeLength tl);
00256   friend COMMON_EXPORT const timeStamp operator-=(timeStamp &ts, timeLength tl);
00257   friend COMMON_EXPORT const timeLength operator-(const timeStamp& a, const timeStamp& b);
00258   friend COMMON_EXPORT const timeStamp operator+(const timeStamp& a, const timeLength& b);
00259   friend COMMON_EXPORT const timeStamp operator-(const timeStamp& a, const timeLength& b);
00260   friend COMMON_EXPORT const timeStamp operator+(const timeLength& a, const timeStamp& b);
00261   // non-member ==, !=, >, <, >=, <=  operators also defined for timeStamp
00262 
00263  private:
00264   COMMON_EXPORT void initI(int64_t iTime, const timeUnit &u, timeBase b);
00265   COMMON_EXPORT timeStamp(int64_t ns_);
00266 };
00267 
00268 COMMON_EXPORT ostream& operator<<(ostream&s, timeStamp z);
00269 
00270 // relTimeStamp ---------------------------------------------------
00271 // A timeStamp that proceeds on a timeline based at "zero"
00272 // It has no relation to time on the "date" timeline.  There is no
00273 // map from the "zero" based timeline for the relTimeStamp to the timeline
00274 // based on "human time" for the timeStamp class.
00275 
00276 class relTimeStamp : public timeParent {
00277  private:
00278   COMMON_EXPORT static const relTimeStamp *_Zero;
00279   COMMON_EXPORT static const relTimeStamp *ZeroHelp();
00280  public:
00281   COMMON_EXPORT static const relTimeStamp &Zero();
00282 
00283   // need this constructor to use in vector container class
00284   COMMON_EXPORT relTimeStamp();
00285   COMMON_EXPORT relTimeStamp(int64_t iTime, const timeUnit &u);
00286   COMMON_EXPORT relTimeStamp(int iTime, const timeUnit &u);
00287   COMMON_EXPORT relTimeStamp(const timeLength &tl);
00288   COMMON_EXPORT relTimeStamp(double dTime, const timeUnit &u);
00289 
00290   // Selectors
00291   COMMON_EXPORT double getD(const timeUnit &u) const;
00292   COMMON_EXPORT int64_t getI(const timeUnit &u) const;
00293   // ostream& put(ostream& s) const { return s << *this; }
00294 
00295   friend COMMON_EXPORT const relTimeStamp operator+=(relTimeStamp &ts, timeLength tl);
00296   friend COMMON_EXPORT const relTimeStamp operator-=(relTimeStamp &ts, timeLength tl);
00297   friend COMMON_EXPORT const timeLength operator-(const relTimeStamp& a,const relTimeStamp& b);
00298   friend COMMON_EXPORT const relTimeStamp operator+(const relTimeStamp& a, const timeLength& b);
00299   friend COMMON_EXPORT const relTimeStamp operator-(const relTimeStamp& a, const timeLength& b);
00300   friend COMMON_EXPORT const relTimeStamp operator+(const timeLength& a, const relTimeStamp& b);
00301   // non-member ==, !=, >, <, >=, <=  operators also defined for relTimeStamp
00302 
00303  private:
00304   COMMON_EXPORT void initI(int64_t iTime, const timeUnit &u);
00305   COMMON_EXPORT relTimeStamp(int64_t ns_);
00306 };
00307 
00308 COMMON_EXPORT ostream& operator<<(ostream&s, relTimeStamp z);
00309 
00310 // timeLength ---------------------------------------------------
00311 
00312 // A timeLength represents a length of time and has no notion of a start or
00313 // base time.  It has a range of signed 64bit integer or about 292 years
00314 // since we're counting nanoseconds.
00315 
00316 class timeLength : public timeParent {
00317  private:
00318   // logically const
00319   COMMON_EXPORT static const timeLength *_zero;
00320   COMMON_EXPORT static const timeLength *_ns;
00321   COMMON_EXPORT static const timeLength *_us;
00322   COMMON_EXPORT static const timeLength *_ms;
00323   COMMON_EXPORT static const timeLength *_sec;
00324   COMMON_EXPORT static const timeLength *_minute;
00325   COMMON_EXPORT static const timeLength *_hour;
00326   COMMON_EXPORT static const timeLength *_day;
00327   COMMON_EXPORT static const timeLength *_year;
00328   COMMON_EXPORT static const timeLength *_leapYear;
00329   COMMON_EXPORT static const timeLength *ZeroHelp();
00330   COMMON_EXPORT static const timeLength *nsHelp();
00331   COMMON_EXPORT static const timeLength *usHelp();
00332   COMMON_EXPORT static const timeLength *msHelp();
00333   COMMON_EXPORT static const timeLength *secHelp();
00334   COMMON_EXPORT static const timeLength *minHelp();
00335   COMMON_EXPORT static const timeLength *hourHelp();
00336   COMMON_EXPORT static const timeLength *dayHelp();
00337   COMMON_EXPORT static const timeLength *yearHelp();
00338   COMMON_EXPORT static const timeLength *leapYearHelp();
00339  public:
00340   COMMON_EXPORT static const timeLength &Zero();
00341   COMMON_EXPORT static const timeLength &ns();
00342   COMMON_EXPORT static const timeLength &us();
00343   COMMON_EXPORT static const timeLength &ms();
00344   COMMON_EXPORT static const timeLength &sec();
00345   COMMON_EXPORT static const timeLength &minute();
00346   COMMON_EXPORT static const timeLength &hour();
00347   COMMON_EXPORT static const timeLength &day();
00348   COMMON_EXPORT static const timeLength &year();
00349   COMMON_EXPORT static const timeLength &leapYear();
00350 
00351   // need this constructor to use in vector container class
00352   COMMON_EXPORT timeLength();
00353   COMMON_EXPORT timeLength(int64_t iTime, const timeUnit &u);
00354   COMMON_EXPORT timeLength(int iTime, const timeUnit &u);
00355   COMMON_EXPORT timeLength(double dTime, const timeUnit &u);
00356 
00357   // Selectors
00358   COMMON_EXPORT double getD(const timeUnit &u) const;
00359   COMMON_EXPORT int64_t getI(const timeUnit &u) const;
00360 
00361   //ostream& put(ostream& s) const { return s << *this; }
00362 
00363   friend COMMON_EXPORT const timeLength operator+=(timeLength &t, timeLength tl);
00364   friend COMMON_EXPORT const timeLength operator-=(timeLength &t, timeLength tl);
00365   friend COMMON_EXPORT const timeLength operator*=(timeLength &t, double d);
00366   friend COMMON_EXPORT const timeLength operator/=(timeLength &t, double d);
00367   friend COMMON_EXPORT const timeLength operator-(const timeLength &t);
00368   friend COMMON_EXPORT const timeLength operator-(const timeStamp& a, const timeStamp& b);
00369   friend COMMON_EXPORT const timeLength operator-(const relTimeStamp& a,const relTimeStamp& b);
00370   friend COMMON_EXPORT const timeStamp operator+(const timeStamp& a, const timeLength& b);
00371   friend COMMON_EXPORT const timeStamp operator-(const timeStamp& a, const timeLength& b);
00372   friend COMMON_EXPORT const timeStamp operator+(const timeLength& a, const timeStamp& b);
00373   friend COMMON_EXPORT const timeLength operator+(const timeLength& a, const timeLength& b);
00374   friend COMMON_EXPORT const timeLength operator-(const timeLength& a, const timeLength& b);
00375   friend COMMON_EXPORT const timeLength operator*(const timeLength& a, double b);
00376   friend COMMON_EXPORT const timeLength operator/(const timeLength& a, double b);
00377   friend COMMON_EXPORT const timeLength operator*(double a, const timeLength& b);
00378   friend COMMON_EXPORT const timeLength operator/(double a, const timeLength& b);
00379   friend COMMON_EXPORT double operator/(const timeLength& a, const timeLength& b);
00380   // non-member ==, !=, >, <, >=, <=  operators also defined for timeLength
00381 
00382  private:
00383   COMMON_EXPORT void initI(int64_t iTime, const timeUnit &u);
00384   // a fast constructor just for timeLength operators
00385   COMMON_EXPORT timeLength(int64_t ns_);
00386 };
00387 
00388 COMMON_EXPORT ostream& operator<<(ostream&s, timeLength z);
00389 
00390 // timeStamp +=/-= timeLength
00391 COMMON_EXPORT const timeStamp operator+=(timeStamp &ts, timeLength tl);
00392 COMMON_EXPORT const timeStamp operator-=(timeStamp &ts, timeLength tl);
00393 
00394 // timeLength +=/-= timeLength
00395 COMMON_EXPORT const timeLength operator+=(timeLength &t, timeLength tl);
00396 COMMON_EXPORT const timeLength operator-=(timeLength &t, timeLength tl);
00397 
00398 // timeLength *=, /= double
00399 COMMON_EXPORT const timeLength operator*=(timeLength &t, double d);
00400 COMMON_EXPORT const timeLength operator/=(timeLength &t, double d);
00401 
00402 // - timeLength
00403 COMMON_EXPORT const timeLength operator-(const timeLength &t);
00404 
00405 // timeStamp - timeStamp = timeLength  ;  the length of time between time stamps
00406 COMMON_EXPORT const timeLength operator-(const timeStamp& a, const timeStamp& b);
00407 
00408 // timeStamp +/- timeLength = timeStamp
00409 COMMON_EXPORT const timeStamp operator+(const timeStamp& a, const timeLength& b);
00410 COMMON_EXPORT const timeStamp operator-(const timeStamp& a, const timeLength& b);
00411 
00412 // timeLength + timeStamp = timeStamp
00413 COMMON_EXPORT const timeStamp operator+(const timeLength& a, const timeStamp& b);
00414 // timeLength - timeStamp doesn't make sense, ie. 3 days - Mar 9 = ?
00415 
00416 // timeLength +/- timeLength = timeLength
00417 COMMON_EXPORT const timeLength operator+(const timeLength& a, const timeLength& b);
00418 COMMON_EXPORT const timeLength operator-(const timeLength& a, const timeLength& b);
00419 
00420 // timeLength */ double = timeLength
00421 COMMON_EXPORT const timeLength operator*(const timeLength& a, double b);
00422 COMMON_EXPORT const timeLength operator/(const timeLength& a, double b);
00423 
00424 // double */ timeLength = timeLength
00425 COMMON_EXPORT const timeLength operator*(double a, const timeLength& b);
00426 COMMON_EXPORT const timeLength operator/(double a, const timeLength& b);
00427 
00428 // Be careful if writing * operators because Time is based at nanosecond
00429 // level, which can overflow when multiplying times that seem small
00430 // eg. Time(1,timeUnit::day) * Time(2,timeUnit::day) will overflow
00431 
00432 // timeStamp @ timeStamp = bool
00433 COMMON_EXPORT bool operator==(const timeStamp& a, const timeStamp& b);
00434 COMMON_EXPORT bool operator!=(const timeStamp& a, const timeStamp& b);
00435 COMMON_EXPORT bool operator>(const timeStamp& a, const timeStamp& b);
00436 COMMON_EXPORT bool operator>=(const timeStamp& a, const timeStamp& b);
00437 COMMON_EXPORT bool operator<(const timeStamp& a, const timeStamp& b);
00438 COMMON_EXPORT bool operator<=(const timeStamp& a, const timeStamp& b);
00439 
00440 COMMON_EXPORT timeStamp earlier(const timeStamp& a, const timeStamp& b);
00441 COMMON_EXPORT timeStamp later(const timeStamp& a, const timeStamp& b);
00442 // timeLength @ timeLength = bool
00443 COMMON_EXPORT bool operator==(const timeLength& a, const timeLength& b);
00444 COMMON_EXPORT bool operator!=(const timeLength& a, const timeLength& b);
00445 COMMON_EXPORT bool operator>(const timeLength& a, const timeLength& b);
00446 COMMON_EXPORT bool operator>=(const timeLength& a, const timeLength& b);
00447 COMMON_EXPORT bool operator<(const timeLength& a, const timeLength& b);
00448 COMMON_EXPORT bool operator<=(const timeLength& a, const timeLength& b);
00449 
00450 
00451 COMMON_EXPORT timeLength minimum(const timeLength& a, const timeLength& b);
00452 
00453 COMMON_EXPORT timeLength maximum(const timeLength& a, const timeLength& b);
00454 COMMON_EXPORT const timeLength abs(const timeLength& a);
00455 
00456 // relTimeStamp +=/-= timeLength
00457 COMMON_EXPORT const relTimeStamp operator+=(relTimeStamp &ts, timeLength tl);
00458 COMMON_EXPORT const relTimeStamp operator-=(relTimeStamp &ts, timeLength tl);
00459 
00460 // relTimeStamp - relTimeStamp = timeLength  ;  the length of time between time stamps
00461 COMMON_EXPORT const timeLength operator-(const relTimeStamp& a, const relTimeStamp& b);
00462 
00463 // relTimeStamp +/- relTimeLength = relTimeStamp
00464 COMMON_EXPORT const relTimeStamp operator+(const relTimeStamp& a, const timeLength& b);
00465 COMMON_EXPORT const relTimeStamp operator-(const relTimeStamp& a, const timeLength& b);
00466 
00467 // timeLength + relTimeStamp = relTimeStamp
00468 COMMON_EXPORT const relTimeStamp operator+(const timeLength& a, const relTimeStamp& b);
00469 // timeLength - timeStamp doesn't make sense, ie. 3 days - Mar 9 = ?
00470 
00471 
00472 // Be careful if writing * operators because Time is based at nanosecond
00473 // level, which can overflow when multiplying times that seem small
00474 // eg. Time(1,timeUnit::day) * Time(2,timeUnit::day) will overflow
00475 
00476 // relTimeStamp @ relTimeStamp = bool
00477 COMMON_EXPORT bool operator==(const relTimeStamp& a, const relTimeStamp& b);
00478 COMMON_EXPORT bool operator!=(const relTimeStamp& a, const relTimeStamp& b);
00479 COMMON_EXPORT bool operator>(const relTimeStamp& a, const relTimeStamp& b);
00480 COMMON_EXPORT bool operator>=(const relTimeStamp& a, const relTimeStamp& b);
00481 COMMON_EXPORT bool operator<(const relTimeStamp& a, const relTimeStamp& b);
00482 COMMON_EXPORT bool operator<=(const relTimeStamp& a, const relTimeStamp& b);
00483 
00484 COMMON_EXPORT relTimeStamp earlier(const relTimeStamp& a, const relTimeStamp& b);
00485 
00486 COMMON_EXPORT relTimeStamp later(const relTimeStamp& a, const relTimeStamp& b);
00487 
00488 
00489 
00490 #endif
00491 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1