Skip to content

Commit

Permalink
Experimental support for setting system time in telescope class
Browse files Browse the repository at this point in the history
  • Loading branch information
knro committed Apr 20, 2018
1 parent 823811d commit 893ad8a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions libindi/libs/indibase/inditelescope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,23 @@ bool Telescope::processTimeInfo(const char *utc, const char *offset)
IUSaveText(&TimeT[1], offset);
TimeTP.s = IPS_OK;
IDSetText(&TimeTP, nullptr);

// 2018-04-20 JM: Update system time on ARM architecture.
#ifdef __arm__
#ifdef __linux__
struct tm utm;
if (strptime(utc, "%Y-%m-%dT%H:%M:%S", &utm))
{
time_t raw_time = mktime(&utm);
time_t now_time;
time(&now_time);
// Only sync if difference > 30 seconds
if (labs(now_time - raw_time) > 30)
stime(&raw_time);
}
#endif
#endif

return true;
}
else
Expand Down

0 comments on commit 893ad8a

Please sign in to comment.