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_INLINE ACE_Date_Time::ACE_Date_Time ( void   ) 

Constructor initializes current time/date info.

Definition at line 54 of file Date_Time.inl.

References ACE_TRACE, and update().

00055 {
00056   ACE_TRACE ("ACE_Date_Time::ACE_Date_Time");
00057   this->update ();
00058 }

ACE_INLINE ACE_Date_Time::ACE_Date_Time ( const ACE_Time_Value timevalue  )  [explicit]

Constructor initializes with the given ACE_Time_Value.

Definition at line 61 of file Date_Time.inl.

References ACE_TRACE, and update().

00062 {
00063   ACE_TRACE ("ACE_Date_Time::ACE_Date_Time: timevalue");
00064   this->update (timevalue);
00065 }

ACE_INLINE 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 
)

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.

References ACE_TRACE.

00077   : day_ (day),
00078     month_ (month),
00079     year_ (year),
00080     hour_ (hour),
00081     minute_ (minute),
00082     second_ (second),
00083     microsec_ (microsec),
00084     wday_ (wday)
00085 {
00086   ACE_TRACE ("ACE_Date_Time::ACE_Date_Time");
00087 }


Member Function Documentation

ACE_INLINE void ACE_Date_Time::day ( long  day  ) 

Set day.

Definition at line 101 of file Date_Time.inl.

References ACE_TRACE, and day_.

00102 {
00103   ACE_TRACE ("ACE_Date_Time::day");
00104   day_ = day;
00105 }

ACE_INLINE long ACE_Date_Time::day ( void   )  const

Get day.

Definition at line 93 of file Date_Time.inl.

References ACE_TRACE, and day_.

00094 {
00095   ACE_TRACE ("ACE_Date_Time::day");
00096   return day_;
00097 }

ACE_INLINE void ACE_Date_Time::hour ( long  hour  ) 

Set hour.

Definition at line 149 of file Date_Time.inl.

References ACE_TRACE, and hour_.

00150 {
00151   ACE_TRACE ("ACE_Date_Time::hour");
00152   hour_ = hour;
00153 }

ACE_INLINE long ACE_Date_Time::hour ( void   )  const

Get hour.

Definition at line 141 of file Date_Time.inl.

References ACE_TRACE, and hour_.

00142 {
00143   ACE_TRACE ("ACE_Date_Time::hour");
00144   return hour_;
00145 }

ACE_INLINE void ACE_Date_Time::microsec ( long  microsec  ) 

Set microsec.

Definition at line 197 of file Date_Time.inl.

References ACE_TRACE, and microsec_.

00198 {
00199   ACE_TRACE ("ACE_Date_Time::microsec");
00200   microsec_ = microsec;
00201 }

ACE_INLINE long ACE_Date_Time::microsec ( void   )  const

Get microsec.

Definition at line 189 of file Date_Time.inl.

References ACE_TRACE, and microsec_.

00190 {
00191   ACE_TRACE ("ACE_Date_Time::microsec");
00192   return microsec_;
00193 }

ACE_INLINE void ACE_Date_Time::minute ( long  minute  ) 

Set minute.

Definition at line 165 of file Date_Time.inl.

References ACE_TRACE, and minute_.

00166 {
00167   ACE_TRACE ("ACE_Date_Time::minute");
00168   minute_ = minute;
00169 }

ACE_INLINE long ACE_Date_Time::minute ( void   )  const

Get minute.

Definition at line 157 of file Date_Time.inl.

References ACE_TRACE, and minute_.

00158 {
00159   ACE_TRACE ("ACE_Date_Time::minute");
00160   return minute_;
00161 }

ACE_INLINE void ACE_Date_Time::month ( long  month  ) 

Set month.

Definition at line 117 of file Date_Time.inl.

References ACE_TRACE, and month_.

00118 {
00119   ACE_TRACE ("ACE_Date_Time::month");
00120   month_ = month;
00121 }

ACE_INLINE long ACE_Date_Time::month ( void   )  const

Get month.

Definition at line 109 of file Date_Time.inl.

References ACE_TRACE, and month_.

00110 {
00111   ACE_TRACE ("ACE_Date_Time::month");
00112   return month_;
00113 }

ACE_INLINE void ACE_Date_Time::second ( long  second  ) 

Set second.

Definition at line 181 of file Date_Time.inl.

References ACE_TRACE, and second_.

00182 {
00183   ACE_TRACE ("ACE_Date_Time::second");
00184   second_ = second;
00185 }

ACE_INLINE long ACE_Date_Time::second ( void   )  const

Get second.

Definition at line 173 of file Date_Time.inl.

References ACE_TRACE, and second_.

00174 {
00175   ACE_TRACE ("ACE_Date_Time::second");
00176   return second_;
00177 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_Date_Time::update ( const ACE_Time_Value timevalue  ) 

Update to the given ACE_Time_Value.

Definition at line 13 of file Date_Time.inl.

References day_, hour_, ACE_OS::localtime_r(), microsec_, minute_, month_, ACE_Time_Value::sec(), second_, ACE_OS::time(), ACE_Time_Value::usec(), wday_, and year_.

00014 {
00015 #if defined (ACE_HAS_WINCE)
00016   // CE doesn't do localtime().
00017   FILETIME file_time = timevalue;
00018   FILETIME local_file_time;
00019   SYSTEMTIME sys_time;
00020   ::FileTimeToLocalFileTime (&file_time, &local_file_time);
00021   ::FileTimeToSystemTime (&local_file_time, &sys_time);
00022   this->day_ = sys_time.wDay;
00023   this->month_ = sys_time.wMonth;
00024   this->year_ = sys_time.wYear;
00025   this->hour_ = sys_time.wHour;
00026   this->minute_ = sys_time.wMinute;
00027   this->second_ = sys_time.wSecond;
00028   this->microsec_ = sys_time.wMilliseconds * 1000;
00029   this->wday_ = sys_time.wDayOfWeek;
00030 #else
00031   time_t time = timevalue.sec ();
00032   struct tm tm_time;
00033   ACE_OS::localtime_r (&time, &tm_time);
00034   this->day_ = tm_time.tm_mday;
00035   this->month_ = tm_time.tm_mon + 1;    // localtime's months are 0-11
00036   this->year_ = tm_time.tm_year + 1900; // localtime reports years since 1900
00037   this->hour_ = tm_time.tm_hour;
00038   this->minute_ = tm_time.tm_min;
00039   this->second_ = tm_time.tm_sec;
00040   this->microsec_ = timevalue.usec ();
00041   this->wday_ = tm_time.tm_wday;
00042 #endif /* ACE_HAS_WINCE */
00043 }

ACE_INLINE void ACE_Date_Time::update ( void   ) 

Update to the current time/date.

Definition at line 46 of file Date_Time.inl.

References ACE_TRACE, and ACE_OS::gettimeofday().

Referenced by ACE_Date_Time().

00047 {
00048   ACE_TRACE ("ACE_Date_Time::update");
00049 
00050   update(ACE_OS::gettimeofday ());
00051 }

ACE_INLINE void ACE_Date_Time::weekday ( long  wday  ) 

Set weekday.

Definition at line 213 of file Date_Time.inl.

References ACE_TRACE, and wday_.

00214 {
00215   ACE_TRACE ("ACE_Date_Time::weekday");
00216   wday_ = wday;
00217 }

ACE_INLINE long ACE_Date_Time::weekday ( void   )  const

Get weekday.

Definition at line 205 of file Date_Time.inl.

References ACE_TRACE, and wday_.

00206 {
00207   ACE_TRACE ("ACE_Date_Time::weekday");
00208   return wday_;
00209 }

ACE_INLINE void ACE_Date_Time::year ( long  year  ) 

Set year.

Definition at line 133 of file Date_Time.inl.

References ACE_TRACE, and year_.

00134 {
00135   ACE_TRACE ("ACE_Date_Time::year");
00136   year_ = year;
00137 }

ACE_INLINE long ACE_Date_Time::year ( void   )  const

Get year.

Definition at line 125 of file Date_Time.inl.

References ACE_TRACE, and year_.

00126 {
00127   ACE_TRACE ("ACE_Date_Time::year");
00128   return year_;
00129 }


Member Data Documentation

long ACE_Date_Time::day_ [private]

Definition at line 108 of file Date_Time.h.

Referenced by day(), and update().

long ACE_Date_Time::hour_ [private]

Definition at line 111 of file Date_Time.h.

Referenced by hour(), and update().

long ACE_Date_Time::microsec_ [private]

Definition at line 114 of file Date_Time.h.

Referenced by microsec(), and update().

long ACE_Date_Time::minute_ [private]

Definition at line 112 of file Date_Time.h.

Referenced by minute(), and update().

long ACE_Date_Time::month_ [private]

Definition at line 109 of file Date_Time.h.

Referenced by month(), and update().

long ACE_Date_Time::second_ [private]

Definition at line 113 of file Date_Time.h.

Referenced by second(), and update().

long ACE_Date_Time::wday_ [private]

Definition at line 115 of file Date_Time.h.

Referenced by update(), and weekday().

long ACE_Date_Time::year_ [private]

Definition at line 110 of file Date_Time.h.

Referenced by update(), and year().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:35:03 2010 for ACE by  doxygen 1.4.7