AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
Date.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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
24namespace agx
25{
28 {
29 public:
39 struct TimeVal {
40 long tv_sec; /* seconds */
41 long tv_usec; /* and microseconds */
42 };
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:254
#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:59
#define AGX_FORCE_INLINE
Definition: macros.h:58
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint64_t UInt
Definition: Integer.h:27
A copy of struct 'timeval' from BSD file sys/time.h.
Definition: Date.h:39
long tv_usec
Definition: Date.h:41