1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-25 17:25:18 +03:00

Implement changes suggested during review

- Move implementation to common/time.
- Use camelCase for function names.
- Store just one value for the RTC, the real time when system
was started.
- Store real time as the number of milliseconds from 1970-01-01.
- Remove BB functions for manipulating time, query the RTC
directly when BB is started.
This commit is contained in:
Alberto García Hierro 2017-09-09 13:04:47 +01:00
parent 64d7fe2bb0
commit 6c8d1303dc
13 changed files with 194 additions and 235 deletions

View file

@ -32,6 +32,7 @@
#include "common/maths.h"
#include "common/streambuf.h"
#include "common/bitarray.h"
#include "common/time.h"
#include "common/utils.h"
#include "drivers/accgyro/accgyro.h"
@ -39,7 +40,6 @@
#include "drivers/compass/compass.h"
#include "drivers/max7456.h"
#include "drivers/pwm_mapping.h"
#include "drivers/rtc.h"
#include "drivers/sdcard.h"
#include "drivers/serial.h"
#include "drivers/system.h"
@ -2116,9 +2116,13 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
case MSP_SET_RTC:
{
int32_t unix = (int32_t)sbufReadU32(src);
uint32_t nanos = sbufReadU32(src);
rtc_set(timestamp_unix(unix, nanos));
// Use seconds and milliseconds to make senders
// easier to implement. Generating a 64 bit value
// might not be trivial in some platforms.
int32_t secs = (int32_t)sbufReadU32(src);
uint16_t millis = sbufReadU16(src);
rtcTime_t t = rtcTimeMake(secs, millis);
rtcSet(&t);
}
break;