MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / ConvertTimeUnitToMS

Method ConvertTimeUnitToMS

libminifi/include/core/Property.h:184–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182
183 template<typename T>
184 static bool ConvertTimeUnitToMS(int64_t input, TimeUnit unit, T &out) {
185 if (unit == NANOSECOND) {
186 out = input / 1000 / 1000;
187 return true;
188 } else if (unit == MICROSECOND) {
189 out = input / 1000;
190 return true;
191 } else if (unit == MILLISECOND) {
192 out = input;
193 return true;
194 } else if (unit == SECOND) {
195 out = input * 1000;
196 return true;
197 } else if (unit == MINUTE) {
198 out = input * 60 * 1000;
199 return true;
200 } else if (unit == HOUR) {
201 out = input * 60 * 60 * 1000;
202 return true;
203 } else if (unit == DAY) {
204 out = 24 * 60 * 60 * 1000;
205 return true;
206 } else {
207 return false;
208 }
209 }
210
211 static bool ConvertTimeUnitToMS(int64_t input, TimeUnit unit, int64_t &out) {
212 return ConvertTimeUnitToMS<int64_t>(input, unit, out);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected