2 #include "ace/Global_Macros.h"
3 #include "ace/Time_Value.h"
4 #include "ace/OS_NS_sys_time.h"
5 #include "ace/OS_NS_time.h"
7 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
10 ACE_Date_Time::update (const ACE_Time_Value& timevalue)
12 time_t time = timevalue.sec ();
14 ACE_OS::localtime_r (&time, &tm_time);
15 this->day_ = tm_time.tm_mday;
16 this->month_ = tm_time.tm_mon + 1; // localtime's months are 0-11
17 this->year_ = tm_time.tm_year + 1900; // localtime reports years since 1900
18 this->hour_ = tm_time.tm_hour;
19 this->minute_ = tm_time.tm_min;
20 this->second_ = tm_time.tm_sec;
21 this->microsec_ = timevalue.usec ();
22 this->wday_ = tm_time.tm_wday;
26 ACE_Date_Time::update ()
28 ACE_TRACE ("ACE_Date_Time::update");
30 update(ACE_OS::gettimeofday ());
34 ACE_Date_Time::ACE_Date_Time ()
36 ACE_TRACE ("ACE_Date_Time::ACE_Date_Time");
41 ACE_Date_Time::ACE_Date_Time (const ACE_Time_Value& timevalue)
43 ACE_TRACE ("ACE_Date_Time::ACE_Date_Time: timevalue");
44 this->update (timevalue);
47 // Constructor with init values, no check for validy
49 ACE_Date_Time::ACE_Date_Time (long day,
66 ACE_TRACE ("ACE_Date_Time::ACE_Date_Time");
69 // set/get portions of ACE_Date_Time, no check for validy
73 ACE_Date_Time::day () const
75 ACE_TRACE ("ACE_Date_Time::day");
81 ACE_Date_Time::day (long day)
83 ACE_TRACE ("ACE_Date_Time::day");
89 ACE_Date_Time::month () const
91 ACE_TRACE ("ACE_Date_Time::month");
97 ACE_Date_Time::month (long month)
99 ACE_TRACE ("ACE_Date_Time::month");
105 ACE_Date_Time::year () const
107 ACE_TRACE ("ACE_Date_Time::year");
113 ACE_Date_Time::year (long year)
115 ACE_TRACE ("ACE_Date_Time::year");
121 ACE_Date_Time::hour () const
123 ACE_TRACE ("ACE_Date_Time::hour");
129 ACE_Date_Time::hour (long hour)
131 ACE_TRACE ("ACE_Date_Time::hour");
137 ACE_Date_Time::minute () const
139 ACE_TRACE ("ACE_Date_Time::minute");
145 ACE_Date_Time::minute (long minute)
147 ACE_TRACE ("ACE_Date_Time::minute");
153 ACE_Date_Time::second () const
155 ACE_TRACE ("ACE_Date_Time::second");
161 ACE_Date_Time::second (long second)
163 ACE_TRACE ("ACE_Date_Time::second");
169 ACE_Date_Time::microsec () const
171 ACE_TRACE ("ACE_Date_Time::microsec");
177 ACE_Date_Time::microsec (long microsec)
179 ACE_TRACE ("ACE_Date_Time::microsec");
180 microsec_ = microsec;
185 ACE_Date_Time::weekday () const
187 ACE_TRACE ("ACE_Date_Time::weekday");
193 ACE_Date_Time::weekday (long wday)
195 ACE_TRACE ("ACE_Date_Time::weekday");
199 ACE_END_VERSIONED_NAMESPACE_DECL