(file) Return to CIMDateTime.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/CIMDateTime.h between version 1.30 and 1.31

version 1.30, 2002/08/16 01:28:06 version 1.31, 2002/08/19 18:04:15
Line 27 
Line 27 
 //              Sushma Fernandes, Hewlett Packard Company //              Sushma Fernandes, Hewlett Packard Company
 //                  (sushma_fernandes@hp.com) //                  (sushma_fernandes@hp.com)
 //              Roger Kumpf, Hewlett Packard Company (roger_kumpf@hp.com) //              Roger Kumpf, Hewlett Packard Company (roger_kumpf@hp.com)
   //              Carol Ann Krug Graves, Hewlett-Packard Company
   //                (carolann_graves@hp.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 36 
Line 38 
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/Array.h> #include <Pegasus/Common/Array.h>
 #include <Pegasus/Common/Linkage.h> #include <Pegasus/Common/Linkage.h>
 #include <time.h>  
 #ifdef PEGASUS_INTERNALONLY  
 #include <iostream>  
 #endif  
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
Line 54 
Line 52 
 /** /**
     The CIMDateTime class represents the CIM datetime data type as a C++ class     The CIMDateTime class represents the CIM datetime data type as a C++ class
     CIMDateTime. A CIM datetime may contain a date or an interval. CIMDateTime     CIMDateTime. A CIM datetime may contain a date or an interval. CIMDateTime
     is an intrinsic CIM data type which represents the time as a formated      is an intrinsic CIM data type which represents the time as a formatted
     fixedplength string.      fixed length string.
  
     <PRE>     <PRE>
     A date has the following form:     A date has the following form:
Line 63 
Line 61 
  
     Where     Where
  
         yyyy = year (0-1999)          yyyy = year (1-9999)
         mm = month (1-12)         mm = month (1-12)
         dd = day (1-31)         dd = day (1-31)
         hh = hour (0-23)         hh = hour (0-23)
         mm = minute (0-59)         mm = minute (0-59)
         ss = second (0-59)         ss = second (0-59)
         mmmmmm = microseconds.          mmmmmm = microseconds
         s = '+' or '-' to represent the UTC sign.          s = '+' or '-' to represent the UTC sign
         utc = UTC offset (same as GMT offset).          utc = UTC offset (same as GMT offset)
  
     An interval has the following form:     An interval has the following form:
  
Line 94 
Line 92 
     better to think of an interval as specifying time elapsed since     better to think of an interval as specifying time elapsed since
     some event.     some event.
  
     CIMDateTime objects are constructed from C character strings or from      CIMDateTime objects are constructed from String objects or from
     other CIMDateTime objects. These character strings must be exactly     other CIMDateTime objects. These character strings must be exactly
     twenty-five characters and conform to one of the forms idententified      twenty-five characters and conform to one of the forms identified
     above.     above.
  
     CIMDateTime objects which are not explicitly initialized will be      CIMDateTime objects that are not explicitly initialized will be
     implicitly initialized with the null time interval:      implicitly initialized with a zero time interval:
  
         00000000000000.000000:000         00000000000000.000000:000
  
     Instances can be tested for nullness with the isNull() method.  
 */ */
 class PEGASUS_COMMON_LINKAGE CIMDateTime class PEGASUS_COMMON_LINKAGE CIMDateTime
 { {
 public: public:
  
     /** Create a new CIMDateTime object with NULL DateTime definition.      /** Creates a new CIMDateTime object with a zero interval value
     */     */
     CIMDateTime();     CIMDateTime();
  
     /** CIMDateTime - Creat a CIM CIMDateTime instance from a string      /** CIMDateTime - Creates a CIM CIMDateTime instance from a string
         constant representing the CIM DateTime formatted datetime          constant representing the CIM DateTime-formatted datetime
         See the class documentation for CIMDateTime for the defintion of the          See the class documentation for CIMDateTime for the definition of the
         input string for absolute and interval datetime.         input string for absolute and interval datetime.
         @param str String object containing the CIM DateTime formatted string          @param str String object containing the CIM DateTime-formatted string
     */     */
     CIMDateTime(const char* str);      CIMDateTime(const String & str);
  
     /** CIMDateTime Create a CIMDateTime instance from another     /** CIMDateTime Create a CIMDateTime instance from another
         CIMDateTime object         CIMDateTime object
Line 141 
Line 138 
     */     */
     CIMDateTime& operator=(const CIMDateTime& x);     CIMDateTime& operator=(const CIMDateTime& x);
  
     /** CIMDateTime isNull method - Tests for an all zero date time. Note that      /** toString - Returns the string representing the DateTime value of the
         today this function checks for absolute datetime == zero, not interval.  
         <PRE>  
         CIMDateTime dt;  
         dt.clear();  
         assert(dt.isNull());  
         </PRE>  
         @return This method returns true of the contents are  
         "00000000000000.000000:000". Else it returns false  
     */  
     Boolean isNull() const;  
   
     /*  ATTN: P3 KS.  This simply returns a string whether the datetime is a  
         real value or the NULL value.  It is up to the user to test.  Should  
         this be modified so we do something like an interupt on NULL?  
     */  
     /** getString - Returns the string representing the DateTime value of the  
         CIMDateTime Object.         CIMDateTime Object.
     */     */
     const char* getString() const;      String toString () const;
  
     /** method set - Sets the date time. Creates the CIMDateTime instance from     /** method set - Sets the date time. Creates the CIMDateTime instance from
         the input string constant which must be         the input string constant which must be
Line 175 
Line 156 
         BadDateTimeFormat         BadDateTimeFormat
         @exception Throws exception BadDateTimeFormat on format error.         @exception Throws exception BadDateTimeFormat on format error.
     */     */
     void set(const char* str);      void set(const String & str);
  
     /**  clear - Clears the datetime class instance. The date time is set to our      /**  clear - Clears the datetime class instance.  The date time is set to
         defintion of NULL, absolute zero date time.           a zero interval value.
     */     */
     void clear();     void clear();
  
     /** Makes a deep copy (clone) of the given object. */  
     CIMDateTime clone() const;  
   
     /**     /**
     Get current time as CIMDateTime. The time returned is the local time.     Get current time as CIMDateTime. The time returned is the local time.
  
     @return CIMDateTime   Contains the current datetime as a CIMDateTime object.     @return CIMDateTime   Contains the current datetime as a CIMDateTime object.
   
     Note: Original code was taken from OperationSystem::getLocalDateTime()  
     */     */
     static CIMDateTime getCurrentDateTime();     static CIMDateTime getCurrentDateTime();
  
     /**     /**
     Get the difference between two CIMDateTimes. This function computes the      Computes the difference in microseconds between two CIMDateTime dates or
     difference between two datetimes or between two intervals. The result      two CIMDateTime intervals
     is truncated and returned as the number of seconds.  
  
     @param startTime     Contains the start time.      @param startTime     Contains the start datetime
  
     @param finishTime    Contains the finish time.      @param finishTime    Contains the finish datetime
  
     @return difference   Difference between the two datetimes in seconds.      @return difference   Difference between the two datetimes in microseconds
  
     @throws BadDateTimeFormat If one argument is a datetime and one is an     @throws BadDateTimeFormat If one argument is a datetime and one is an
                               interval.                                interval
     */     */
     static Sint64 getDifference(CIMDateTime startTime, CIMDateTime finishTime);     static Sint64 getDifference(CIMDateTime startTime, CIMDateTime finishTime);
  
Line 217 
Line 192 
     */     */
     Boolean isInterval();     Boolean isInterval();
  
 private:  
   
     CIMDateTimeRep* _rep;  
   
     Boolean _set(const char* str);  
   
     /**     /**
        This function extracts the different components of the date and time      Compares the CIMDateTime object to another CIMDateTime object for equality
        from the string passed and assigns it to the tm structure.  
   
        @param dateTimeStr  Contains the string to be assigned.  
  
        @param tm           Contains the tm structure to be updated.      @return True if the two CIMDateTime objects are equal,
               False otherwise
     */     */
     static void formatDateTime(char* dateTime, tm* tm);      Boolean equal (const CIMDateTime & x) const;
  
     // ATTN  private:
     /** CIMDateTime - Friend operator Test for CIMDateTime  
         equality      CIMDateTimeRep* _rep;
     */  
     PEGASUS_COMMON_LINKAGE friend Boolean operator==(      Boolean _set(const String & dateTimeStr);
         const CIMDateTime& x,  
         const CIMDateTime& y);  
 }; };
  
 PEGASUS_COMMON_LINKAGE Boolean operator==( PEGASUS_COMMON_LINKAGE Boolean operator==(
     const CIMDateTime& x,     const CIMDateTime& x,
     const CIMDateTime& y);     const CIMDateTime& y);
  
 #ifdef PEGASUS_INTERNALONLY  
 PEGASUS_COMMON_LINKAGE PEGASUS_STD(ostream)& operator<<(  
     PEGASUS_STD(ostream)& os,  
     const CIMDateTime& x);  
 #endif  
   
 #define PEGASUS_ARRAY_T CIMDateTime #define PEGASUS_ARRAY_T CIMDateTime
 # include <Pegasus/Common/ArrayInter.h> # include <Pegasus/Common/ArrayInter.h>
 #undef PEGASUS_ARRAY_T #undef PEGASUS_ARRAY_T


Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2