time.cpp
Go to the documentation of this file.
1 #include "time.h"
2 
3 #include <IceUtil/Time.h>
4 
6 
7 #include <RobotAPI/libraries/aron/common/aron/time.aron.generated.h>
8 
9 void
11 {
12  bo = IceUtil::Time::microSeconds(dto);
13 }
14 
15 void
16 IceUtil::toAron(long& dto, const IceUtil::Time& bo)
17 {
18  dto = bo.toMicroSeconds();
19 }
20 
21 void
23 {
24  fromIce(dto, bo);
25 }
26 
27 void
29 {
30  toIce(dto, bo);
31 }
32 
33 void
35 {
36  switch (dto.value)
37  {
38  case arondto::ClockType::Realtime:
39  bo = ClockType::Realtime;
40  break;
41  case arondto::ClockType::Monotonic:
42  bo = ClockType::Monotonic;
43  break;
44  case arondto::ClockType::Virtual:
45  bo = ClockType::Virtual;
46  break;
47  case arondto::ClockType::Unknown:
48  bo = ClockType::Unknown;
49  break;
50  }
51 }
52 
53 void
55 {
56  switch (bo)
57  {
58  case ClockType::Realtime:
59  dto = arondto::ClockType::Realtime;
60  break;
61  case ClockType::Monotonic:
62  dto = arondto::ClockType::Monotonic;
63  break;
64  case ClockType::Virtual:
65  dto = arondto::ClockType::Virtual;
66  break;
67  case ClockType::Unknown:
68  dto = arondto::ClockType::Unknown;
69  break;
70  }
71 }
72 
73 void
75 {
76  bo = Duration::MicroSeconds(dto.microSeconds);
77 }
78 
79 void
81 {
82  dto.microSeconds = bo.toMicroSeconds();
83 }
84 
85 void
86 armarx::aron::time::fromAron(const arondto::Frequency& dto, armarx::Frequency& bo)
87 {
88  Duration cycleDuration;
89  fromAron(dto.cycleDuration, cycleDuration);
90 
91  bo = Frequency(cycleDuration);
92 }
93 
94 void
95 armarx::aron::time::toAron(arondto::Frequency& dto, const armarx::Frequency& bo)
96 {
97  toAron(dto.cycleDuration, bo.toCycleDuration());
98 }
99 
100 void
101 armarx::aron::time::fromAron(const arondto::DateTime& dto, armarx::DateTime& bo)
102 {
103  ClockType clockType;
104  fromAron(dto.clockType, clockType);
105 
106  Duration timeSinceEpoch;
107  fromAron(dto.timeSinceEpoch, timeSinceEpoch);
108 
109  bo = DateTime(timeSinceEpoch, clockType, dto.hostname);
110 }
111 
112 void
113 armarx::aron::time::toAron(arondto::DateTime& dto, const armarx::DateTime& bo)
114 {
115  toAron(dto.clockType, bo.clockType());
116  toAron(dto.timeSinceEpoch, bo.toDurationSinceEpoch());
117  dto.hostname = bo.hostname();
118 }
IceUtil::toAron
void toAron(long &dto, const IceUtil::Time &bo)
Definition: time.cpp:16
armarx::aron::time::fromAron
void fromAron(const arondto::ClockType &dto, ClockType &bo)
Definition: time.cpp:34
time.h
armarx::core::time::Frequency
Represents a frequency.
Definition: Frequency.h:17
ice_conversions.h
armarx::aron::time::toAron
void toAron(arondto::ClockType &dto, const ClockType &bo)
Definition: time.cpp:54
armarx::core::eigen::fromIce
void fromIce(Eigen::Vector2f &e, const Ice::FloatSeq &ice)
Definition: ice_conversions.cpp:10
armarx::core::time::ClockType
ClockType
Describes the type of clock.
Definition: ClockType.h:10
armarx::core::eigen::toIce
void toIce(const Eigen::Vector2f &e, Ice::FloatSeq &ice)
Definition: ice_conversions.cpp:17
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
IceUtil::fromAron
void fromAron(const long &dto, IceUtil::Time &bo)
Definition: time.cpp:10
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::core::time::Duration
Represents a duration.
Definition: Duration.h:17
armarx::fromAron
void fromAron(const arondto::PackagePath &dto, PackageFileLocation &bo)
armarx::toAron
void toAron(arondto::PackagePath &dto, const PackageFileLocation &bo)
armarx::armem::Duration
armarx::core::time::Duration Duration
Definition: forward_declarations.h:14
armarx::aron::bo
const std::optional< BoT > & bo
Definition: aron_conversions.h:168