Commit 0f66f2f2 authored by Gus Grubba's avatar Gus Grubba Committed by Lorenz Meier

Add time since boot

parent f35b2631
......@@ -15,6 +15,18 @@
namespace QGC
{
static quint64 gBootTime = 0;
void initTimer()
{
gBootTime = groundTimeMilliseconds();
}
quint64 bootTimeMilliseconds()
{
return groundTimeMilliseconds() - gBootTime;
}
quint64 groundTimeUsecs()
{
return groundTimeMilliseconds() * 1000;
......
......@@ -37,6 +37,11 @@ float limitAngleToPMPIf(double angle);
/** @brief Returns the angle limited to -pi - pi */
double limitAngleToPMPId(double angle);
/** @brief Records boot time (called from main) */
void initTimer();
/** @brief Get the ground time since boot in milliseconds */
quint64 bootTimeMilliseconds();
const static int MAX_FLIGHT_TIME = 60 * 60 * 24 * 21;
class SLEEP : public QThread
......
......@@ -15,6 +15,7 @@
*
*/
#include "QGC.h"
#include <QtGlobal>
#include <QApplication>
#include <QIcon>
......@@ -238,6 +239,9 @@ int main(int argc, char *argv[])
}
#endif
//-- Record boot time
QGC::initTimer();
#ifdef Q_OS_UNIX
//Force writing to the console on UNIX/BSD devices
if (!qEnvironmentVariableIsSet("QT_LOGGING_TO_CONSOLE"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment