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
1dc7fcf0
Commit
1dc7fcf0
authored
6 years ago
by
Theodoros Katzalis
Browse files
Options
Downloads
Patches
Plain Diff
Some `int` types changed to `uint` and the comments are updated
parent
ce0b423b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inc/Helpers/TimeHelper.hpp
+17
-9
17 additions, 9 deletions
inc/Helpers/TimeHelper.hpp
with
17 additions
and
9 deletions
inc/Helpers/TimeHelper.hpp
+
17
−
9
View file @
1dc7fcf0
...
@@ -36,10 +36,10 @@ struct TimeAndDate {
...
@@ -36,10 +36,10 @@ struct TimeAndDate {
*/
*/
class
TimeHelper
{
class
TimeHelper
{
private:
private:
int
SecondsPerMinute
=
60
;
u
int
8_t
SecondsPerMinute
=
60
;
int
SecondsPerHour
=
3600
;
u
int
16_t
SecondsPerHour
=
3600
;
int
SecondsPerDay
=
86400
;
u
int
32_t
SecondsPerDay
=
86400
;
int
DaysOfMonth
[
12
]
=
{
31
,
28
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
};
u
int
8_t
DaysOfMonth
[
12
]
=
{
31
,
28
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
};
/**
/**
* @param year The year that will be examined if it is a leap year(366 days)
* @param year The year that will be examined if it is a leap year(366 days)
...
@@ -51,9 +51,13 @@ private:
...
@@ -51,9 +51,13 @@ private:
* Convert UTC date to elapsed seconds since Unix epoch(1/1/1970 00:00:00). This is a
* Convert UTC date to elapsed seconds since Unix epoch(1/1/1970 00:00:00). This is a
* reimplemented mktime() of <ctime> library in an embedded systems way
* reimplemented mktime() of <ctime> library in an embedded systems way
*
*
* Note:
* This function can convert UTC dates after 1 January 2019
*
* @param TimeInfo the time information/data from the RTC(UTC format)
* @param TimeInfo the time information/data from the RTC(UTC format)
* @return the elapsed seconds between a given UTC date(after the Unix epoch) and Unix epoch
* @return the elapsed seconds between a given UTC date(after the Unix epoch) and Unix epoch
* @todo change the epoch for computer-efficiency
* @todo check if we need to change the epoch to ,the recommended from the standard, 1 January
* 1958
*/
*/
uint32_t
mkUTCtime
(
struct
TimeAndDate
&
TimeInfo
);
uint32_t
mkUTCtime
(
struct
TimeAndDate
&
TimeInfo
);
...
@@ -61,9 +65,13 @@ private:
...
@@ -61,9 +65,13 @@ private:
* Convert elapsed seconds since Unix epoch to UTC date. This is a reimplemented gmtime() of
* Convert elapsed seconds since Unix epoch to UTC date. This is a reimplemented gmtime() of
* <ctime> library in an embedded systems way
* <ctime> library in an embedded systems way
*
*
* Note:
* This function can convert elapsed seconds after 1 January 2019 since Unix epoch
*
* @param seconds elapsed seconds since Unix epoch
* @param seconds elapsed seconds since Unix epoch
* @return the UTC date based on the /p
* @return the UTC date based on the /p
* @todo change the epoch for computer efficiency
* @todo check if we need to change the epoch to ,the recommended from the standard, 1 January
* 1958
*/
*/
struct
TimeAndDate
utcTime
(
uint32_t
seconds
);
struct
TimeAndDate
utcTime
(
uint32_t
seconds
);
...
@@ -80,7 +88,6 @@ public:
...
@@ -80,7 +88,6 @@ public:
* day` segments. The P-field won't be included in the code, because as the ECSS standards
* day` segments. The P-field won't be included in the code, because as the ECSS standards
* claims, it can be just implicitly declared.
* claims, it can be just implicitly declared.
* @param TimeInfo is the data provided from RTC(Real Time Clock)
* @param TimeInfo is the data provided from RTC(Real Time Clock)
* @todo check if we need to define other epoch than the 1 January 1970
* @todo time security for critical time operations
* @todo time security for critical time operations
* @todo declare the implicit P-field
* @todo declare the implicit P-field
* @todo check if we need milliseconds
* @todo check if we need milliseconds
...
@@ -90,8 +97,9 @@ public:
...
@@ -90,8 +97,9 @@ public:
/**
/**
* Parse the CDS time format(3.3 in CCSDS 301.0-B-4 standard)
* Parse the CDS time format(3.3 in CCSDS 301.0-B-4 standard)
*
*
* @param seconds elapsed seconds since Unix epoch
* @param data time information provided from the ground segment
* @return the UTC date based on the /p
* @param length the size of the time information
* @return the UTC date
*/
*/
static
struct
TimeAndDate
parseCDStimeFormat
(
const
uint8_t
*
data
,
uint8_t
length
);
static
struct
TimeAndDate
parseCDStimeFormat
(
const
uint8_t
*
data
,
uint8_t
length
);
...
...
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