Mobile API Reference  MicroStrategy 2019
TimeSpan.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : TimeSpan.h
3 // AUTHOR : Yuxiao Xiao
4 // CREATION : 8/24/01
5 // Copyright (C) MicroStrategy, Inc. 2001
6 //==============================================================================================
7 #ifndef MDataType_TimeSpan_h
8 #define MDataType_TimeSpan_h
9 
11 
12 #include "DataType.h"
13 
14 namespace MDataType
15 {
16 #ifndef DATETIME_CONST
17 #define DATETIME_CONST
18 //ydong
19  const Int64 DAY_IN_MILLISECONDS = (24*60*60*1000);
20  const Int64 HOUR_IN_MILLISECONDS = (60*60*1000);
21  const Int64 MINUTE_IN_MILLISECONDS = (60*1000);
24 
25  const Int32 DAY_IN_HOURS = 24;
26  const Int32 DAY_IN_MINUTES = (24*60);
27  const Int32 DAY_IN_SECONDS = (24*60*60);
28 #endif
29  //==============================================================================================
30  // TimeSpan represents a period of time
31  // It's a stack object.
32  // It's size is IMMUTABLE - you cannot make a bug fix to create a new member!!!
33  //==============================================================================================
34 
36  {
37  public:
38 
39  TimeSpan(Int64 inMilliSeconds=0);
40  TimeSpan(Int32 inDays, Int32 inHours, Int32 inMinutes=0, Int32 inSeconds=0, Int32 inMilliseconds=0);
41  TimeSpan(const TimeSpan&);
42 
43  ~TimeSpan() throw();
44 
45  // Get TimeSpan in number of days, not limited by 1 - 31
46  Int32 GetTotalDays() const;
47  // Get TimeSpan in number of hours, not limited by 0 - 23
48  Int32 GetTotalHours() const;
49  // Get TimeSpan in number of minutes, not limited by 0 - 59
50  Int32 GetTotalMinutes() const;
51  // Get TimeSpan in number of seconds, not limited by 0 - 59
52  Int32 GetTotalSeconds() const;
53  // Get TimeSpan in number of milliseconds
54  Int64 GetTotalMilliseconds() const;
55 
56  TimeSpan& operator = (const TimeSpan& irSrc);
57 
58  const TimeSpan& operator -= (const TimeSpan& irOther);
59  const TimeSpan& operator += (const TimeSpan& irOther);
60 
61  TimeSpan operator - (const TimeSpan& irOther) const;
62  TimeSpan operator + (const TimeSpan& irOther) const;
63 
64  bool operator == (const TimeSpan& irOther) const;
65  bool operator != (const TimeSpan& irOther) const;
66  bool operator > (const TimeSpan& irOther) const;
67  bool operator < (const TimeSpan& irOther) const;
68  bool operator >= (const TimeSpan& irOther) const;
69  bool operator <= (const TimeSpan& irOther) const;
70 
71  private:
72  Int64 mnMilliseconds;
73  };
74 }
75 
76 #endif // MDataType_TimeSpan_h
bool operator<(const ::GUID &irGUID1, const ::GUID &irGUID2)
Definition: Base/Base/GUID.h:156
bool operator==(const Allocator< _Ty > &left, const Allocator< _UT > &right)
Definition: Allocator.h:204
Definition: TimeSpan.h:35
#define Int64
Definition: BasicTypes.h:36
#define DLL_DATATYPE_EXIM
Definition: DataType.h:22
Definition: BigDecimal.h:18
const Int64 HOUR_IN_MILLISECONDS
Definition: TimeSpan.h:20
#define Int32
Definition: BasicTypes.h:20
const Int32 DAY_IN_HOURS
Definition: TimeSpan.h:25
const Int64 DAY_IN_MILLISECONDS
Definition: TimeSpan.h:19
bool operator!=(const Allocator< _Ty > &left, const Allocator< _UT > &right)
Definition: Allocator.h:211
const Int32 DAY_IN_MINUTES
Definition: TimeSpan.h:26
const Int64 MINUTE_IN_MILLISECONDS
Definition: TimeSpan.h:21
const Int64 SECOND_IN_MILLISECONDS
Definition: TimeSpan.h:22
const Int32 DAY_IN_SECONDS
Definition: TimeSpan.h:27
const Int64 MILLISECOND_IN_NANOSECONDS
Definition: TimeSpan.h:23