Browse Source

【主线待合】新增获取程序编译日期的功能

dma_temp
Lizongdi 1 week ago
parent
commit
47dec22c57
  1. 7
      library/common/common.c
  2. 1
      library/common/include/common.h

7
library/common/common.c

@ -4,6 +4,8 @@
#include "common.h"
#include <stdarg.h> // 必须包含此头文件以使用变参宏
static char g_sBuildTime[64] = {0};
WEAK void elog_output(uint8_t level, const char *tag, const char *file, const char *func, long line, const char *format, ...)
{
#ifdef BUILD_COMMON
@ -93,3 +95,8 @@ int Rd_RegularFileExists(const char *_psPath)
return (stat(_psPath, &sb) == 0) && S_ISREG(sb.st_mode);
}
char *Rd_GetBuildTime(void)
{
snprintf(g_sBuildTime, sizeof(g_sBuildTime), "%s %s", __DATE__, __TIME__);
return g_sBuildTime;
}

1
library/common/include/common.h

@ -153,6 +153,7 @@ int Rd_String2Array(char *_pSrc, char *_pRes[], int _iNum, char *_Ptr);
int Rd_Array2String(char *_pRes, int _iLen, char *_pSrc[], int _iNum, char *_Ptr);
int Rd_FileExists(const char *_psPath);
int Rd_RegularFileExists(const char *_psPath);
char *Rd_GetBuildTime(void);
#ifdef BUILD_LOG
extern void Rd_ElogEnableStrong(void);

Loading…
Cancel
Save