mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge #20018
20018: tests/pkg/minmea: fixing RMC timestamp r=benpicco a=jan-mo The RMC timestamp calculation was creating issues. The timestamp will be related to the EPOCH and time zone. Test on native will fail if the time zone is not set correctly. (see #20005) # how to test ``` TZ=GMT-1 make test ``` and ``` TZ=GMT make test ``` and ``` TZ=<any> make test ``` `timedatectl list-timezones` provides you with a List of timzones do not fail Co-authored-by: Jan Mohr <jan.mohr@ml-pa.com>
This commit is contained in:
commit
47f0446685
@ -106,12 +106,6 @@ int _parse_nmea_msg(const char* nmea_msg)
|
||||
if (minmea_parse_rmc(&frame, nmea_msg) && frame.valid) {
|
||||
puts("check_nmea: RMC recorded");
|
||||
|
||||
/* parse timestamp */
|
||||
struct tm tm;
|
||||
time_t timestamp;
|
||||
minmea_getdatetime(&tm, &frame.date, &frame.time);
|
||||
timestamp = mktime(&tm);
|
||||
|
||||
/* print values */
|
||||
print_str("\tlat: ");
|
||||
print_float(minmea_tocoord(&frame.latitude), 6);
|
||||
@ -119,7 +113,10 @@ int _parse_nmea_msg(const char* nmea_msg)
|
||||
print_str("\tlon: ");
|
||||
print_float(minmea_tocoord(&frame.longitude), 6);
|
||||
printf("\n");
|
||||
printf("\ttime: %"PRIu32"\n", (uint32_t)timestamp);
|
||||
/* NMEA RMC is providing UTC time */
|
||||
printf("\tdate: %d.%d.%d\n", frame.date.day, frame.date.month, frame.date.year);
|
||||
printf("\ttime: %dh %dm %ds, %dms\n", frame.time.hours, frame.time.minutes,
|
||||
frame.time.seconds, frame.time.microseconds/1000);
|
||||
}
|
||||
else {
|
||||
puts("check_nmea: invalid RMC record");
|
||||
|
@ -32,7 +32,8 @@ def testfunc(child):
|
||||
child.expect_exact('check_nmea: RMC recorded\r\n')
|
||||
child.expect_exact('\tlat: 52.450366\r\n')
|
||||
child.expect_exact('\tlon: 13.298649\r\n')
|
||||
child.expect_exact('\ttime: 1697808102\r\n')
|
||||
child.expect_exact('\tdate: 20.10.23\r\n')
|
||||
child.expect_exact('\ttime: 14h 21m 42s, 227ms\r\n')
|
||||
child.expect_exact('SUCCESS\r\n')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user