AGX Dynamics  2.35.0.1
Date.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, is copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_DATE_H
18 #define AGX_DATE_H
19 
20 #include <agx/String.h>
21 #include <agx/Object.h>
22 
23 
24 namespace agx
25 {
28  {
29  public:
39  struct TimeVal {
40  long tv_sec; /* seconds */
41  long tv_usec; /* and microseconds */
42  };
43  Date();
44  Date(UInt seconds, UInt microSeconds = 0);
45 
46 
49 
52 
53  tm& getTmTime();
54  const tm& getTmTime() const;
55 
56  TimeVal& getTimevalTime();
57  const TimeVal& getTimevalTime() const;
58 
59  long long getMilliseconds() const;
60 
61  bool operator>(const Date& other) const;
62 
63  void update();
64 
65 
72  static bool convertDateToISO(const agx::String& compileDate, agx::String& isoDate);
73 
74 
75  protected:
76  virtual ~Date();
77 
78 
79  private:
80  TimeVal m_timevalTime;
81  tm m_tmTime;
82  };
83 
84 
85  /* Implementation */
86  AGX_FORCE_INLINE tm& Date::getTmTime() { return m_tmTime; }
87  AGX_FORCE_INLINE const tm& Date::getTmTime() const { return m_tmTime; }
88 
90  AGX_FORCE_INLINE const Date::TimeVal& Date::getTimevalTime() const { return m_timevalTime; }
91 
92 }
93 
94 
95 #endif /* AGX_DATE_H */
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXCORE_EXPORT
Definition: Date.h:28
Date(UInt seconds, UInt microSeconds=0)
agx::String toStringTime() const
static bool convertDateToISO(const agx::String &compileDate, agx::String &isoDate)
Convert a date in the DATE format ("Mmm dd yyyy" -> "Aug 12 2012") into ISO standard: YYYY-MM-DD.
virtual ~Date()
tm & getTmTime()
Definition: Date.h:86
long long getMilliseconds() const
bool operator>(const Date &other) const
TimeVal & getTimevalTime()
Definition: Date.h:89
void update()
agx::String toStringDateAndTime() const
agx::Object is a refcounted object with a name.
Definition: Object.h:60
#define AGX_FORCE_INLINE
Definition: macros.h:58
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt
Definition: Integer.h:34
A copy of struct 'timeval' from BSD file sys/time.h.
Definition: Date.h:39
long tv_usec
Definition: Date.h:41