Index

DKTimestamp

Purpose:

DKTimestamp is a class to hold the timestamp data type. When represented as a string, the default format of DKTimestamp is yyyy-mo-dd-hh.mi.ss.nnnnnn, as required by the majority of datastores. nnnnnn is the nanosecond fraction of the time. DKDDO supports DKTimestamp objects; that is, it can send an attribute with DKTimestamp type, in and out of a datastore.

Class summary:

 class DKTimestamp
 {
 public:
 
  DKTimestamp(int nYear, int nMonth, int nDay,
                  int nHour=0, int nMin=0, 
                  int nSec=0, int nNano=0);
  DKTimestamp(const DKTimestamp &t); 
  DKTimestamp();
  DKTimestamp(const char* timestampString)
  virtual DKTimestamp();
 
  dkBoolean operator== (const DKTimestamp& DKTimestamp) const;
  dkBoolean operator!= (const DKTimestamp& DKTimestamp) const;
 
  dkString asString(const char * pFormat) const;
 
  int      getYear()    const;
  int      getMonth()   const;
  int      getDay()     const;
  int      getHours()   const;
  int      getMinutes() const;
  int      getSeconds() const;
  int      getNanos()   const;
  void setNanos(int nn);
  static DKTimestamp fromString(const char* timestampString);
  friend DKEXPORT ostream& 
                  operator << (ostream& 
                               outstream, 
                               const DKTime& time);
 };

Members:

Constructor
nYear is an integer in yyyy format. The valid range for nMonth is between 1 and 12, inclusive. nDay is the day of the month, an integer between 1 and 31, inclusive. nHours ranges from zero to 23 inclusive, nMin is between zero and 59 inclusive, as is also nSec. nNano is the nanosecond fraction of the time. The constructor without an argument creates a DKTimestamp object with the current timestamp. The timestamp character string is in yyyy-mo-dd-hh.mi.ss.nnnnnn format.
  DKTimestamp(int nYear, int nMonth, int nDay,
              int nHour=0, int nMin=0, 
              int nSec=0, int nNano=0);
  DKTimestamp(const DKTimestamp &t);
  DKTimestamp();
  DKTimestamp(const char* timestampString);
 

Member functions

asString
Gets the string representation of this timestamp. The input string format pFormat follows the formatting convention described in the standard C-routine strftime for the appropriate platform. The default format of DKTimestamp is yyyy-mo-dd-hh.mi.ss.nnnnnn, as required by the majority of datastores.
dkString asString(const char * pFormat) const;

operator ==
Returns TRUE if the value of this timestamp is equal to the input parameter.
dkBoolean operator == (const DKTimestamp& dkTimestamp) const;

operator !=
Returns TRUE if the value of this timestamp is not equal to the input parameter.
dkBoolean operator!= (const DKTimestamp& dkTimestamp) const;

getYear
Returns the value of the year in this timestamp, an integer in yyyy format.
int getYear() const;

getMonth
Returns the value of the month in this timestamp, an integer between 1 and 12 inclusive, where 1 represents the month of January.
int getMonth() const;

getDay
Returns the day of the month in this timestamp, an integer between 1 and 31 inclusive.
int getDay() const;

getHours
Returns the value of the hour in this timestamp. The value is an integer between zero and 23, inclusive.
int getHours() const;

getMinutes
Returns the value of the minutes after the hour in this timestamp. The value is an integer between zero and 59, inclusive.
int getMinutes()  const;

getSeconds
Returns the value of the seconds after the minutes in this timestamp. The value is an integer between zero and 59, inclusive.
int getSeconds()  const;

getNanos
Returns the nanosecond fraction of time in this timestamp.
int getNanos()  const;

setNanos
Sets the nanosecond fraction of time in this timestamp.
void setNanos(int nn);

operator <<
Output the string representation of this timestamp. The default format is yyyy-mo-dd-hh.mi.ss.nnnnnn, as required by the majority of datastores.
ostream& operator << (ostream& outstream, const DKTimestamp& timestamp);

fromString
Creates a DKTimestamp object in yyyy-mo-dd-hh.mi.ss.nnnnnn format from an input string.
dkTimestamp fromString (const char* timestampString);

(c) Copyright International Business Machines Corporation 1996, 2003. IBM Corp. All rights reserved.