Skip to content
Snippets Groups Projects
Commit 1f851864 authored by thodkatz's avatar thodkatz
Browse files

Trying to fix Vera

parent 87b2ac0c
No related branches found
No related tags found
No related merge requests found
...@@ -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
...@@ -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;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment