Commit d4ec3f8b authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

Fixed date setting from GPS

parent 7558fc34
......@@ -29,9 +29,13 @@
#include "settings.h"
#include <usbdbg.h>
#include <stdio.h>
void set_time_fr_gps_main(void *params)
{
/* Avoid compiler warning */
(void) params;
struct tm time;
struct gps_utc gpstime;
char b[32];
......@@ -44,20 +48,20 @@ void set_time_fr_gps_main(void *params)
usbdbg_puts(b);
sprintf(b, "OFS: %d-%d-%d %d:%d:%d\r\n",
setting_gmt_ofs.tm_year, setting_gmt_ofs.tm_mon, setting_gmt_ofs.tm_wday,
setting_gmt_ofs.tm_year, setting_gmt_ofs.tm_mon, setting_gmt_ofs.tm_mday,
setting_gmt_ofs.tm_hour, setting_gmt_ofs.tm_min, setting_gmt_ofs.tm_sec);
usbdbg_puts(b);
time.tm_year = gpstime.yr;
time.tm_mon = gpstime.mon;
time.tm_wday = gpstime.day;
time.tm_mday = gpstime.day;
time.tm_hour = gpstime.hr + setting_gmt_ofs.tm_hour;
time.tm_min = gpstime.min + setting_gmt_ofs.tm_min;
time.tm_sec = gpstime.sec;
time.tm_isdst = 0;
sprintf(b, "AFT: %d-%d-%d %d:%d:%d\r\n",
time.tm_year, time.tm_mon, time.tm_wday,
time.tm_year, time.tm_mon, time.tm_mday,
time.tm_hour, time.tm_min, time.tm_sec);
usbdbg_puts(b);
......
......@@ -80,12 +80,12 @@ static void gpsbkgnd_task(void *params)
// usbdbg_puts(b);
if (firstfix ||
((time.tm_hour == 12) && (time.tm_min == 00))) {
((time.tm_hour == 12) && (time.tm_min == 0))) {
gps_get_utc(&gpstime);
time.tm_year = gpstime.yr;
time.tm_mon = gpstime.mon;
time.tm_wday = gpstime.day;
time.tm_mday = gpstime.day;
time.tm_hour = gpstime.hr + setting_gmt_ofs.tm_hour;
time.tm_min = gpstime.min + setting_gmt_ofs.tm_min;
time.tm_sec = gpstime.sec;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment