fix: timezone issue

This commit is contained in:
Tobias Reisinger 2020-05-07 01:41:16 +02:00
parent ad7a6028b3
commit 27cec1d8cc
10 changed files with 27 additions and 28 deletions
handlers

View file

@ -15,12 +15,14 @@
void
handler_loop(controller_t *controller)
{
time_t timestamp = time(NULL);
struct tm *time_struct = localtime(&timestamp);
LOG_DEBUG("===== IDLE LOOP START =====\n");
for(uint_fast8_t i = 0; i < controller->relay_count; ++i)
{
relay_t *relay = controller->relays[i];
int is_active = 0;
if(relay_is_active(relay, time(NULL)))
if(relay_is_active(relay, time_struct))
{
LOG_DEBUG("relay %d is active\n", i);
is_active = 1;