Public Member Functions | Private Attributes

ACE_Date_Time Class Reference

System independent representation of date and time. More...

#include <Date_Time.h>

List of all members.

Public Member Functions

 ACE_Date_Time (void)
 Constructor initializes current time/date info.
 ACE_Date_Time (const ACE_Time_Value &timevalue)
 Constructor initializes with the given ACE_Time_Value.
 ACE_Date_Time (long day, long month=0, long year=0, long hour=0, long minute=0, long second=0, long microsec=0, long wday=0)
void update (void)
 Update to the current time/date.
void update (const ACE_Time_Value &timevalue)
 Update to the given ACE_Time_Value.
long day (void) const
 Get day.
void day (long day)
 Set day.
long month (void) const
 Get month.
void month (long month)
 Set month.
long year (void) const
 Get year.
void year (long year)
 Set year.
long hour (void) const
 Get hour.
void hour (long hour)
 Set hour.
long minute (void) const
 Get minute.
void minute (long minute)
 Set minute.
long second (void) const
 Get second.
void second (long second)
 Set second.
long microsec (void) const
 Get microsec.
void microsec (long microsec)
 Set microsec.
long weekday (void) const
 Get weekday.
void weekday (long wday)
 Set weekday.

Private Attributes

long day_
long month_
long year_
long hour_
long minute_
long second_
long microsec_
long wday_

Detailed Description

System independent representation of date and time.

Definition at line 33 of file Date_Time.h.


Constructor & Destructor Documentation

ACE_Date_Time::ACE_Date_Time ( void   )  [inline]

Constructor initializes current time/date info.

Definition at line 54 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::ACE_Date_Time");
  this->update ();
}

ACE_Date_Time::ACE_Date_Time ( const ACE_Time_Value timevalue  )  [inline, explicit]

Constructor initializes with the given ACE_Time_Value.

Definition at line 61 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::ACE_Date_Time: timevalue");
  this->update (timevalue);
}

ACE_Date_Time::ACE_Date_Time ( long  day,
long  month = 0,
long  year = 0,
long  hour = 0,
long  minute = 0,
long  second = 0,
long  microsec = 0,
long  wday = 0 
) [inline]

Constructor with init values, no check for validy Set/get portions of ACE_Date_Time, no check for validity.

Definition at line 69 of file Date_Time.inl.

  : day_ (day),
    month_ (month),
    year_ (year),
    hour_ (hour),
    minute_ (minute),
    second_ (second),
    microsec_ (microsec),
    wday_ (wday)
{
  ACE_TRACE ("ACE_Date_Time::ACE_Date_Time");
}


Member Function Documentation

long ACE_Date_Time::day ( void   )  const [inline]

Get day.

Definition at line 93 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::day");
  return day_;
}

void ACE_Date_Time::day ( long  day  )  [inline]

Set day.

Definition at line 101 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::day");
  day_ = day;
}

long ACE_Date_Time::hour ( void   )  const [inline]

Get hour.

Definition at line 141 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::hour");
  return hour_;
}

void ACE_Date_Time::hour ( long  hour  )  [inline]

Set hour.

Definition at line 149 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::hour");
  hour_ = hour;
}

void ACE_Date_Time::microsec ( long  microsec  )  [inline]

Set microsec.

Definition at line 197 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::microsec");
  microsec_ = microsec;
}

long ACE_Date_Time::microsec ( void   )  const [inline]

Get microsec.

Definition at line 189 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::microsec");
  return microsec_;
}

long ACE_Date_Time::minute ( void   )  const [inline]

Get minute.

Definition at line 157 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::minute");
  return minute_;
}

void ACE_Date_Time::minute ( long  minute  )  [inline]

Set minute.

Definition at line 165 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::minute");
  minute_ = minute;
}

long ACE_Date_Time::month ( void   )  const [inline]

Get month.

Definition at line 109 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::month");
  return month_;
}

void ACE_Date_Time::month ( long  month  )  [inline]

Set month.

Definition at line 117 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::month");
  month_ = month;
}

long ACE_Date_Time::second ( void   )  const [inline]

Get second.

Definition at line 173 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::second");
  return second_;
}

void ACE_Date_Time::second ( long  second  )  [inline]

Set second.

Definition at line 181 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::second");
  second_ = second;
}

void ACE_Date_Time::update ( const ACE_Time_Value timevalue  )  [inline]

Update to the given ACE_Time_Value.

Definition at line 13 of file Date_Time.inl.

{
#if defined (ACE_HAS_WINCE)
  // CE doesn't do localtime().
  FILETIME file_time = timevalue;
  FILETIME local_file_time;
  SYSTEMTIME sys_time;
  ::FileTimeToLocalFileTime (&file_time, &local_file_time);
  ::FileTimeToSystemTime (&local_file_time, &sys_time);
  this->day_ = sys_time.wDay;
  this->month_ = sys_time.wMonth;
  this->year_ = sys_time.wYear;
  this->hour_ = sys_time.wHour;
  this->minute_ = sys_time.wMinute;
  this->second_ = sys_time.wSecond;
  this->microsec_ = sys_time.wMilliseconds * 1000;
  this->wday_ = sys_time.wDayOfWeek;
#else
  time_t time = timevalue.sec ();
  struct tm tm_time;
  ACE_OS::localtime_r (&time, &tm_time);
  this->day_ = tm_time.tm_mday;
  this->month_ = tm_time.tm_mon + 1;    // localtime's months are 0-11
  this->year_ = tm_time.tm_year + 1900; // localtime reports years since 1900
  this->hour_ = tm_time.tm_hour;
  this->minute_ = tm_time.tm_min;
  this->second_ = tm_time.tm_sec;
  this->microsec_ = timevalue.usec ();
  this->wday_ = tm_time.tm_wday;
#endif /* ACE_HAS_WINCE */
}

void ACE_Date_Time::update ( void   )  [inline]

Update to the current time/date.

Definition at line 46 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::update");

  update(ACE_OS::gettimeofday ());
}

void ACE_Date_Time::weekday ( long  wday  )  [inline]

Set weekday.

Definition at line 213 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::weekday");
  wday_ = wday;
}

long ACE_Date_Time::weekday ( void   )  const [inline]

Get weekday.

Definition at line 205 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::weekday");
  return wday_;
}

long ACE_Date_Time::year ( void   )  const [inline]

Get year.

Definition at line 125 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::year");
  return year_;
}

void ACE_Date_Time::year ( long  year  )  [inline]

Set year.

Definition at line 133 of file Date_Time.inl.

{
  ACE_TRACE ("ACE_Date_Time::year");
  year_ = year;
}


Member Data Documentation

long ACE_Date_Time::day_ [private]

Definition at line 108 of file Date_Time.h.

long ACE_Date_Time::hour_ [private]

Definition at line 111 of file Date_Time.h.

long ACE_Date_Time::microsec_ [private]

Definition at line 114 of file Date_Time.h.

long ACE_Date_Time::minute_ [private]

Definition at line 112 of file Date_Time.h.

long ACE_Date_Time::month_ [private]

Definition at line 109 of file Date_Time.h.

long ACE_Date_Time::second_ [private]

Definition at line 113 of file Date_Time.h.

long ACE_Date_Time::wday_ [private]

Definition at line 115 of file Date_Time.h.

long ACE_Date_Time::year_ [private]

Definition at line 110 of file Date_Time.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines