Index

DKTime

Purpose:

DKTime is a class to hold the time data type. When represented as a string, the default format of DKTime is hh.mm.ss, as required by the majority of datastores. DKDDO supports DKTime objects; that is, it can send an attribute with DKTime type, in and out of a datastore.

Class summary:

 class DKTime
 {
 public:
 
  DKTime(int nHour=0, int nMin=0, int nSec=0);
  DKTime(const DKTime& time); 
  DKTime();
  DKTime(const char* timeString);
 
  virtual DKTime();
 
  dkString asString(const char * pFormat) const;
 
  int      getHours()    const;
  int      getMinutes()  const;
  int      getSeconds()  const;
 
  static DKTime fromString(const char* timeString);
  friend DKEXPORT ostream& 
                  operator << (ostream& outstream,
                               const DKTime& time);
 };

Members:

Constructor
nHour ranges from zero to 23, nMin ranges from zero to 59, nSec also ranges from zero to 59. On the Win32 platform, the first constructor takes an additional DST parameter which is defaulted to -1. The constructor without an argument creates a DKTime object with the current time. The time character string input is in the hh.mm.ss format.
  DKTime(int nHour=0, int nMin=0, int nSec=0);
  DKTime(const DKTime& time);
  DKTime();
  DKTime(const char* timeString);
 

Member functions

asString
Gets the string representation of this time. The input string format pFormat follows the formatting convention described in the standard C-routine strftime for the appropriate platform.
dkString asString(const char * pFormat) const;

getHours
Returns the value of the hours in this time, an integer between zero and 23, inclusive.
int getHours() const;

getMinutes
Returns the value of the minutes after the hours in this time. 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 time. The value is an integer between zero and "59", inclusive.
int getSeconds() const;

operator <<
Output the string representation of this time. The default format is hh.mm.ss, as required by the majority of datastores.
ostream& operator << (ostream& outstream, const DKDate& date);

fromString
Creates a DKTime object in hh.mm.ss format from an input string.
DKTime fromString (const char* timeString);

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