util.cc File Reference
Utility function implementations. More...
#include "util.hh"
Include dependency graph for util.cc:

Functions | |
quint64 | dfti::getTimeUsec (void) |
Get timestamp in microseconds. More... | |
quint64 | dfti::gpsToUnixUsec (quint64 gpsTime) |
Convert GPS timestamp in nanoseconds to Unix timestamp in microseconds. More... | |
quint64 | dfti::gpsToUnixSec (quint64 gpsTime) |
Convert GPS timestamp in nanoseconds to Unix timestamp in seconds. More... | |
float | dfti::hzToMsec (quint8 rate) |
Convert Hertz rate to millisecond sampling time. More... | |
float | dfti::hzToUsec (quint8 rate) |
Convert Hertz rate to microsecond sampling time. More... | |
float | dfti::secToMsec (quint8 period) |
Convert seconds to microseconds. More... | |
Detailed Description
Utility function implementations.
- Copyright
- Copyright © 2016-2017 Vehicle Systems & Control Laboratory, Department of Aerospace Engineering, Texas A&M University
- License
- BSD 2-Clause License
Function Documentation
quint64 dfti::getTimeUsec | ( | void | ) |
Get timestamp in microseconds.
- Remarks
- If you are using this function on an embedded computer without a Real Time Clock, this is probably the time since boot.
- Returns
- Unix time, microseconds since Jan 1, 1970.
quint64 dfti::gpsToUnixSec | ( | quint64 | gpsTime | ) |
Convert GPS timestamp in nanoseconds to Unix timestamp in seconds.
- Parameters
-
gpsTime Timestamp from GPS epoch (0000 6 JAN 1980) in nanoseconds.
- Remarks
- This function is used to generate a timestamp to update the system time of an embedded computer without an RTC using date(1).
quint64 dfti::gpsToUnixUsec | ( | quint64 | gpsTime | ) |
Convert GPS timestamp in nanoseconds to Unix timestamp in microseconds.
- Parameters
-
gpsTime Timestamp from GPS epoch (0000 6 JAN 1980) in nanoseconds.
float dfti::hzToMsec | ( | quint8 | rate | ) |
Convert Hertz rate to millisecond sampling time.
- Parameters
-
rate Sampling rate in Hz.
- Returns
- Sampling period in milliseconds.
float dfti::hzToUsec | ( | quint8 | rate | ) |
Convert Hertz rate to microsecond sampling time.
- Parameters
-
rate Sampling rate in Hz.
- Returns
- Sampling period in microseconds.
float dfti::secToMsec | ( | quint8 | period | ) |
Convert seconds to microseconds.
- Parameters
-
period Time in seconds.
- Returns
- Period in microseconds.