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
1f851864
Commit
1f851864
authored
6 years ago
by
thodkatz
Browse files
Options
Downloads
Patches
Plain Diff
Trying to fix Vera
parent
87b2ac0c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inc/Services/TimeManagementService.hpp
+3
-4
3 additions, 4 deletions
inc/Services/TimeManagementService.hpp
src/Helpers/TimeHelper.cpp
+6
-6
6 additions, 6 deletions
src/Helpers/TimeHelper.cpp
with
9 additions
and
10 deletions
inc/Services/TimeManagementService.hpp
+
3
−
4
View file @
1f851864
...
@@ -50,7 +50,7 @@ public:
...
@@ -50,7 +50,7 @@ public:
void
cdsTimeReport
(
struct
TimeAndDate
&
TimeInfo
);
void
cdsTimeReport
(
struct
TimeAndDate
&
TimeInfo
);
/**
/**
* TC[9,128] CDS time request
* TC[9,128] CDS time request
*
*
* This function is a custom subservice(mission specific) with message type 128(as defined
* This function is a custom subservice(mission specific) with message type 128(as defined
...
@@ -58,12 +58,11 @@ public:
...
@@ -58,12 +58,11 @@ public:
* time-management telecommand packet. This data is formatted according to the CDS time code
* time-management telecommand packet. This data is formatted according to the CDS time code
* format(check class `TimeHelper` for the format)
* format(check class `TimeHelper` for the format)
*
*
* @param timeData the data of the parsed space packet for the ST[09] time management
* @param timeData the data of the parsed space packet for the ST[09] time management
* @param length the size of the time data
* @param length the size of the time data
*/
*/
struct
TimeAndDate
cdsTimeRequest
(
Message
&
message
);
struct
TimeAndDate
cdsTimeRequest
(
Message
&
message
);
};
};
#endif //ECSS_SERVICES_TIMEMANAGEMENTSERVICE_HPP
#endif //ECSS_SERVICES_TIMEMANAGEMENTSERVICE_HPP
This diff is collapsed.
Click to expand it.
src/Helpers/TimeHelper.cpp
+
6
−
6
View file @
1f851864
...
@@ -36,7 +36,7 @@ struct TimeAndDate TimeHelper::utcTime(uint32_t seconds) {
...
@@ -36,7 +36,7 @@ struct TimeAndDate TimeHelper::utcTime(uint32_t seconds) {
TimeInfo
.
second
=
0
;
TimeInfo
.
second
=
0
;
// calculate years
// calculate years
while
(
seconds
>=
(
IsLeapYear
(
TimeInfo
.
year
)
?
366
:
365
)
*
SecondsPerDay
)
{
while
(
seconds
>=
(
IsLeapYear
(
TimeInfo
.
year
)
?
366
:
365
)
*
SecondsPerDay
)
{
TimeInfo
.
year
++
;
TimeInfo
.
year
++
;
seconds
-=
(
IsLeapYear
(
TimeInfo
.
year
)
?
366
:
365
)
*
SecondsPerDay
;
seconds
-=
(
IsLeapYear
(
TimeInfo
.
year
)
?
366
:
365
)
*
SecondsPerDay
;
}
}
...
@@ -45,9 +45,9 @@ struct TimeAndDate TimeHelper::utcTime(uint32_t seconds) {
...
@@ -45,9 +45,9 @@ struct TimeAndDate TimeHelper::utcTime(uint32_t seconds) {
uint8_t
i
=
0
;
uint8_t
i
=
0
;
while
(
seconds
>=
(
DaysOfMonth
[
i
]
*
SecondsPerDay
))
{
while
(
seconds
>=
(
DaysOfMonth
[
i
]
*
SecondsPerDay
))
{
TimeInfo
.
month
++
;
TimeInfo
.
month
++
;
seconds
-=
(
DaysOfMonth
[
i
]
*
SecondsPerDay
);
seconds
-=
(
DaysOfMonth
[
i
]
*
SecondsPerDay
);
i
++
;
i
++
;
if
(
i
==
1
&&
(
seconds
>=
(
IsLeapYear
(
TimeInfo
.
year
)
?
29
:
28
)
*
SecondsPerDay
))
{
if
(
i
==
1
&&
(
seconds
>=
(
IsLeapYear
(
TimeInfo
.
year
)
?
29
:
28
)
*
SecondsPerDay
))
{
TimeInfo
.
month
++
;
TimeInfo
.
month
++
;
seconds
-=
(
IsLeapYear
(
TimeInfo
.
year
)
?
29
:
28
)
*
SecondsPerDay
;
seconds
-=
(
IsLeapYear
(
TimeInfo
.
year
)
?
29
:
28
)
*
SecondsPerDay
;
i
++
;
i
++
;
...
@@ -55,19 +55,19 @@ struct TimeAndDate TimeHelper::utcTime(uint32_t seconds) {
...
@@ -55,19 +55,19 @@ struct TimeAndDate TimeHelper::utcTime(uint32_t seconds) {
}
}
// calculate days
// calculate days
while
(
seconds
>=
SecondsPerDay
){
while
(
seconds
>=
SecondsPerDay
)
{
TimeInfo
.
day
++
;
TimeInfo
.
day
++
;
seconds
-=
SecondsPerDay
;
seconds
-=
SecondsPerDay
;
}
}
// calculate hours
// calculate hours
while
(
seconds
>=
SecondsPerHour
){
while
(
seconds
>=
SecondsPerHour
)
{
TimeInfo
.
hour
++
;
TimeInfo
.
hour
++
;
seconds
-=
SecondsPerHour
;
seconds
-=
SecondsPerHour
;
}
}
// calculate minutes
// calculate minutes
while
(
seconds
>=
SecondsPerMinute
){
while
(
seconds
>=
SecondsPerMinute
)
{
TimeInfo
.
minute
++
;
TimeInfo
.
minute
++
;
seconds
-=
SecondsPerMinute
;
seconds
-=
SecondsPerMinute
;
}
}
...
...
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