Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
f79ecee9
Commit
f79ecee9
authored
Jun 10, 2014
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #695 from Susurrus/time_fix
Refactored QGC::groundTime*() functions to be simpler.
parents
8714e12a
ada0f073
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
17 deletions
+11
-17
QGC.cc
src/QGC.cc
+3
-15
QGC.h
src/QGC.h
+8
-2
No files found.
src/QGC.cc
View file @
f79ecee9
...
...
@@ -30,29 +30,17 @@ namespace QGC
quint64
groundTimeUsecs
()
{
QDateTime
time
=
QDateTime
::
currentDateTime
();
time
=
time
.
toUTC
();
/* Return seconds and milliseconds, in milliseconds unit */
quint64
microseconds
=
time
.
toTime_t
()
*
static_cast
<
quint64
>
(
1000000
);
return
static_cast
<
quint64
>
(
microseconds
+
(
time
.
time
().
msec
()
*
1000
));
return
groundTimeMilliseconds
()
*
1000
;
}
quint64
groundTimeMilliseconds
()
{
QDateTime
time
=
QDateTime
::
currentDateTime
();
time
=
time
.
toUTC
();
/* Return seconds and milliseconds, in milliseconds unit */
quint64
seconds
=
time
.
toTime_t
()
*
static_cast
<
quint64
>
(
1000
);
return
static_cast
<
quint64
>
(
seconds
+
(
time
.
time
().
msec
()));
return
static_cast
<
quint64
>
(
QDateTime
::
currentMSecsSinceEpoch
());
}
qreal
groundTimeSeconds
()
{
QDateTime
time
=
QDateTime
::
currentDateTime
();
time
=
time
.
toUTC
();
/* Return time in seconds unit */
quint64
seconds
=
time
.
toTime_t
();
return
static_cast
<
qreal
>
(
seconds
+
(
time
.
time
().
msec
()
/
1000.0
));
return
static_cast
<
qreal
>
(
groundTimeMilliseconds
())
/
1000.0
f
;
}
float
limitAngleToPMPIf
(
float
angle
)
...
...
src/QGC.h
View file @
f79ecee9
...
...
@@ -75,11 +75,17 @@ const QColor colorDarkYellow(180, 180, 0);
const
QColor
colorBackground
(
"#050508"
);
const
QColor
colorBlack
(
0
,
0
,
0
);
/** @brief Get the current ground time in microseconds */
/**
* @brief Get the current ground time in microseconds.
* @note This does not have microsecond precision, it is limited to millisecond precision.
*/
quint64
groundTimeUsecs
();
/** @brief Get the current ground time in milliseconds */
quint64
groundTimeMilliseconds
();
/** @brief Get the current ground time in seconds */
/**
* @brief Get the current ground time in fractional seconds
* @note Precision is limited to milliseconds.
*/
qreal
groundTimeSeconds
();
/** @brief Returns the angle limited to -pi - pi */
float
limitAngleToPMPIf
(
float
angle
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment