CFx SDK Documentation  2022 SP0
OdTimeStamp.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 
25 
26 
27 #ifndef _ODTIME_INCLUDED_
28 #define _ODTIME_INCLUDED_
29 
30 #include "TD_PackPush.h"
31 class OdString;
32 
42 {
43 public:
45  {
46  kInitZero = 1, // Midnight, January 1, 1970, UTC.
47  kInitLocalTime = 2, // Workstation date in local time.
48  kInitUniversalTime = 3 // Workstation date in Universal (Greenwich Mean) Time.
49  };
50 
67  InitialValue init);
68 
75  void getDate(
76  short& month,
77  short& day,
78  short& year) const;
79 
86  void setDate(
87  short month,
88  short day,
89  short year);
90 
94  short month() const;
95 
100  void setMonth(
101  short month);
102 
106  short day() const;
107 
112  void setDay(
113  short day);
114 
118  short year() const;
119 
124  void setYear(
125  short year);
126 
134  void getTime(
135  short& hour,
136  short& minute,
137  short& second,
138  short& millisecond) const;
139 
147  void setTime(
148  short hour,
149  short minute,
150  short second,
151  short millisecond);
152 
156  short hour() const;
157 
162  void setHour(
163  short hour);
164 
168  short minute() const;
169 
174  void setMinute(
175  short minute);
176 
180  short second() const;
181 
186  void setSecond(short second);
187 
191  short millisecond() const;
192 
198  short millisecond);
199 
203  void setToZero();
204 
208  void getLocalTime();
209 
214 
219 
224 
229 
236  OdUInt32 julianDay);
237 
242 
249  OdUInt32 msecsPastMidnight);
250 
258  OdUInt32 julianDay,
259  OdUInt32 msecsPastMidnight);
260 
267  double julianFraction() const;
268 
276  double julianFraction);
277 
279  const OdTimeStamp& tStamp) const;
280 
282  const OdTimeStamp& tStamp) const
283  {
284  return !(operator==(tStamp));
285  }
286 
287  bool operator>(
288  const OdTimeStamp& tStamp) const;
289 
291  const OdTimeStamp& tStamp) const
292  {
293  return ! operator<(tStamp);
294  }
295 
296  bool operator<(
297  const OdTimeStamp& tStamp) const;
298 
300  const OdTimeStamp& tStamp) const
301  {
302  return ! operator>(tStamp);
303  }
304 
306  const OdTimeStamp &tStamp) const
307  {
308  return OdTimeStamp(*this) += tStamp;
309  }
310 
312  const OdTimeStamp &tStamp) const
313  {
314  return OdTimeStamp(*this) -= tStamp;
315  }
316 
318  const OdTimeStamp &tStamp);
319 
321  const OdTimeStamp &tStamp);
322 
328  const OdTimeStamp& add(
329  const OdTimeStamp &tStamp)
330  {
331  return operator+=(tStamp);
332  }
333 
340  const OdTimeStamp &tStamp)
341  {
342  return operator-=(tStamp);
343  }
344 
355  void ctime(
356  class OdString& timeString) const;
357 
406  void strftime(
407  const OdString& format,
408  OdString &timeString) const;
409 
421  short weekday() const;
422 private:
423  OdUInt32 m_julianDay;
424  OdUInt32 m_msec;
425 };
426 #include "TD_PackPop.h"
427 
428 #endif // _ODTIME_INCLUDED_
429 
unsigned int OdUInt32
bool operator<(const OdString &s1, const OdString &s2)
Definition: OdString.h:1284
bool operator>(const OdString &s1, const OdString &s2)
Definition: OdString.h:1307
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
Definition: Int64.h:43
void setToZero()
bool operator==(const OdTimeStamp &tStamp) const
void getUniversalTime()
void setTime(short hour, short minute, short second, short millisecond)
short day() const
void setJulianDay(OdUInt32 julianDay)
void getDate(short &month, short &day, short &year) const
void setDate(short month, short day, short year)
void getTime(short &hour, short &minute, short &second, short &millisecond) const
bool operator!=(const OdTimeStamp &tStamp) const
Definition: OdTimeStamp.h:281
double julianFraction() const
bool operator>(const OdTimeStamp &tStamp) const
short millisecond() const
void universalToLocal()
void setDay(short day)
short year() const
const OdTimeStamp & add(const OdTimeStamp &tStamp)
Definition: OdTimeStamp.h:328
short hour() const
void localToUniversal()
void setJulianFraction(double julianFraction)
short second() const
bool operator>=(const OdTimeStamp &tStamp) const
Definition: OdTimeStamp.h:290
void setMsecsPastMidnight(OdUInt32 msecsPastMidnight)
bool operator<=(const OdTimeStamp &tStamp) const
Definition: OdTimeStamp.h:299
void setHour(short hour)
short weekday() const
void setMillisecond(short millisecond)
const OdTimeStamp & operator-=(const OdTimeStamp &tStamp)
bool operator<(const OdTimeStamp &tStamp) const
void setSecond(short second)
void setMonth(short month)
void setPackedValue(OdInt64 t)
OdTimeStamp(InitialValue init)
void setJulianDate(OdUInt32 julianDay, OdUInt32 msecsPastMidnight)
short month() const
OdUInt32 msecsPastMidnight() const
void ctime(class OdString &timeString) const
const OdTimeStamp & operator+=(const OdTimeStamp &tStamp)
const OdTimeStamp & subtract(const OdTimeStamp &tStamp)
Definition: OdTimeStamp.h:339
OdInt64 packedValue() const
const OdTimeStamp operator+(const OdTimeStamp &tStamp) const
Definition: OdTimeStamp.h:305
OdUInt32 julianDay() const
void setYear(short year)
void strftime(const OdString &format, OdString &timeString) const
const OdTimeStamp operator-(const OdTimeStamp &tStamp) const
Definition: OdTimeStamp.h:311
short minute() const
void setMinute(short minute)
void getLocalTime()
GLint GLint GLint GLsizei GLsizei GLenum format
Definition: gles2_ext.h:111
bool DAI_EXPORT operator==(const OdFileDescriptionAuto &left, const OdFileDescriptionAuto &right)