time.c 256 Bytes
Newer Older
Jacob Priddy's avatar
Jacob Priddy committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include "app/event.h"
#include "time.h"

int door_time_get_current_hour(void)
{
	time_t now;
	struct tm time_info;
	if (!door_rtos_get_event(TIME_SYNCED_EVENT))
	{
		return -1;
	}
	time(&now);

	localtime_r(&now, &time_info);
	return time_info.tm_hour;
}