Get current local time

Display current local time in readale format
#include <time.h>
#include <dlog.h> // for logging purposes


void
get_current_time() {
	time_t raw_time;
	struct tm* time_info;

	time(&raw_time);
	time_info = localtime(&raw_time);
	LOGI("Current time: %d:%s%d", time_info->tm_hour, time_info->tm_min<10? "0" : "", time_info->tm_min);
}

Responses

0 Replies