Ejemplo n.º 1
0
static void EsifDataLogFire(int isHeader)
{
	int i = 0;
	char outLine[MAX_LOG_LINE] = { 0 };
	EsifLogType logtype = ESIF_LOG_UI;
	time_t now = time(NULL);
	struct tm time = { 0 };
	esif_ccb_time_t msec = 0;

	esif_ccb_system_time(&msec);

	if (isHeader > 0) {
		esif_ccb_sprintf(MAX_LOG_LINE, outLine, "Time,Server Msec,");
	}
	else {
		if (esif_ccb_localtime(&time, &now) == 0) {
				esif_ccb_sprintf(MAX_LOG_LINE, outLine, "%04d-%02d-%02d %02d:%02d:%02d,%llu,",
					time.tm_year + 1900, time.tm_mon + 1, time.tm_mday, time.tm_hour, time.tm_min, time.tm_sec, msec);
		}
	}
	for (i = 0; i < MAX_PARTICIPANT_ENTRY; i++) {
		eEsifError rc = ESIF_OK;
		DataLogParticipant currentParticipant = g_dataLogParticipants[i];

		if (currentParticipant.participantNumFields > 0) {
			rc = EsifDataLogAddParticipant(outLine, i, isHeader);
		}
	}
	EsifLogFile_Write(logtype, "%s\n", outLine);
}
Ejemplo n.º 2
0
static eEsifError EsifDataLogOpenLogFile()
{
	eEsifError rc = ESIF_OK;
	EsifLogType logtype = ESIF_LOG_UI;
	char logname[35] = { 0 };
	int append = ESIF_FALSE;
	char fullpath[MAX_PATH] = { 0 };
	time_t now = time(NULL);
	struct tm time = { 0 };

	if (esif_ccb_localtime(&time, &now) == 0) {
		esif_ccb_sprintf(sizeof(logname), logname, "data_log_%04d-%02d-%02d-%02d%02d%02d.csv",
			time.tm_year + 1900, time.tm_mon + 1, time.tm_mday, time.tm_hour, time.tm_min, time.tm_sec);
	}
	EsifLogFile_Open(logtype, logname, append);
	EsifLogFile_GetFullPath(fullpath, sizeof(fullpath), logname);
	if (!EsifLogFile_IsOpen(logtype)) {
		rc = ESIF_E_IO_ERROR;
		goto exit;
	}
exit:
	return rc;
}
Ejemplo n.º 3
0
void EsifTime::refresh(void)
{
	m_timeStamp = getCurrentTime();
	time_t now = time(NULL);
	esif_ccb_localtime(&m_localTime, &now);
}