Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
ECSS Services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AcubeSat-OBC
ECSS Services
Commits
d19b2ced
"git@git.noc.ruhr-uni-bochum.de:pohlsvkp/teqp_fork_old.git" did not exist on "44fb39c770db8bb4d176a6d407785667a2823557"
Commit
d19b2ced
authored
6 years ago
by
thodkatz
Browse files
Options
Downloads
Patches
Plain Diff
Trying to fix vera and clang-tidy
parent
1f851864
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Helpers/TimeHelper.cpp
+17
-13
17 additions, 13 deletions
src/Helpers/TimeHelper.cpp
with
17 additions
and
13 deletions
src/Helpers/TimeHelper.cpp
+
17
−
13
View file @
d19b2ced
#include
"Helpers/TimeHelper.hpp"
bool
TimeHelper
::
IsLeapYear
(
uint16_t
year
)
{
if
(
year
%
4
!=
0
)
return
false
;
if
(
year
%
100
!=
0
)
return
true
;
if
(
year
%
4
!=
0
)
{
return
false
;
}
if
(
year
%
100
!=
0
)
{
return
true
;
}
return
(
year
%
400
)
==
0
;
}
uint32_t
TimeHelper
::
mkUTCtime
(
struct
TimeAndDate
&
timeInfo
)
{
uint32_t
secs
=
0
;
for
(
uint16_t
y
=
1970
;
y
<
timeInfo
.
year
;
++
y
)
for
(
uint16_t
y
=
1970
;
y
<
timeInfo
.
year
;
++
y
)
{
secs
+=
(
IsLeapYear
(
y
)
?
366
:
365
)
*
SecondsPerDay
;
}
for
(
uint16_t
m
=
1
;
m
<
timeInfo
.
month
;
++
m
)
{
secs
+=
DaysOfMonth
[
m
-
1
]
*
SecondsPerDay
;
if
(
m
==
2
&&
IsLeapYear
(
timeInfo
.
year
))
if
(
m
==
2
&&
IsLeapYear
(
timeInfo
.
year
))
{
secs
+=
SecondsPerDay
;
}
}
secs
+=
(
timeInfo
.
day
-
1
)
*
SecondsPerDay
;
secs
+=
timeInfo
.
hour
*
SecondsPerHour
;
...
...
@@ -114,16 +118,16 @@ uint64_t TimeHelper::implementCDSTimeFormat(struct TimeAndDate &TimeInfo) {
return
timeFormat
;
}
struct
TimeAndDate
TimeHelper
::
parseCDSTimeFormat
(
uint8_t
*
timeD
ata
,
uint8_t
length
)
{
struct
TimeAndDate
TimeHelper
::
parseCDSTimeFormat
(
uint8_t
*
d
ata
,
uint8_t
length
)
{
// check if we have the correct length of the packet data
assertI
(
length
!=
48
,
ErrorHandler
::
InternalErrorType
::
UnknownInternalError
);
uint16_t
elapsedDays
=
(
static_cast
<
uint16_t
>
(
timeD
ata
[
0
]))
<<
8
|
static_cast
<
uint16_t
>
(
timeD
ata
[
1
]);
uint32_t
msOfDay
=
(
static_cast
<
uint32_t
>
(
timeD
ata
[
2
]))
<<
24
|
(
static_cast
<
uint32_t
>
(
timeD
ata
[
3
]))
<<
16
|
(
static_cast
<
uint32_t
>
(
timeD
ata
[
4
]))
<<
8
|
static_cast
<
uint32_t
>
(
timeD
ata
[
5
]);
uint16_t
elapsedDays
=
(
static_cast
<
uint16_t
>
(
d
ata
[
0
]))
<<
8
|
static_cast
<
uint16_t
>
(
d
ata
[
1
]);
uint32_t
msOfDay
=
(
static_cast
<
uint32_t
>
(
d
ata
[
2
]))
<<
24
|
(
static_cast
<
uint32_t
>
(
d
ata
[
3
]))
<<
16
|
(
static_cast
<
uint32_t
>
(
d
ata
[
4
]))
<<
8
|
static_cast
<
uint32_t
>
(
d
ata
[
5
]);
uint32_t
seconds
=
elapsedDays
*
86400
+
msOfDay
/
1000
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment