struct yang_data *yang_data_new_date_and_time(const char *xpath, time_t time)
{
	struct tm tm;
	char timebuf[MONOTIME_STRLEN];
	struct timeval _time, time_real;
	char *ts_dot;
	uint16_t buflen;

	_time.tv_sec = time;
	_time.tv_usec = 0;
	monotime_to_realtime(&_time, &time_real);

	gmtime_r(&time_real.tv_sec, &tm);

	/* rfc-3339 format */
	strftime(timebuf, sizeof(timebuf), "%Y-%m-%dT%H:%M:%S", &tm);
	buflen = strlen(timebuf);
	ts_dot = timebuf + buflen;

	/* microseconds and appends Z */
	snprintfrr(ts_dot, sizeof(timebuf) - buflen, ".%06luZ",
		   (unsigned long)time_real.tv_usec);

	return yang_data_new(xpath, timebuf);
}
struct yang_data *yang_data_new_date_and_time(const char *xpath, time_t time)
{
	struct tm tm;
	char timebuf[MONOTIME_STRLEN];
	struct timeval _time, time_real;
	char *ts_dot;
	uint16_t buflen;

	_time.tv_sec = time;
	_time.tv_usec = 0;
	monotime_to_realtime(&_time, &time_real);

	gmtime_r(&time_real.tv_sec, &tm);

	 
	strftime(timebuf, sizeof(timebuf), "%Y-%m-%dT%H:%M:%S", &tm);
	buflen = strlen(timebuf);
	ts_dot = timebuf + buflen;

	 
	snprintfrr(ts_dot, sizeof(timebuf) - buflen, ".%06luZ",
		   (unsigned long)time_real.tv_usec);

	return yang_data_new(xpath, timebuf);
}