20220420 在打印格式化内容前加上当前时间
(定义)
void ky_printf_format_time(){
char format_time[64] = {0};
int ret = ky_get_format_time(format_time, sizeof(format_time));
if(ret == 0){
printf("ky_printf_string_and_format_time get format time failed!\n");
}
printf("[%s]", format_time);
}
#define KY_PRINTF_STRING_AND_FORMAT_TIME ky_printf_format_time();printf
(调用)
KY_PRINTF_STRING_AND_FORMAT_TIME("The program is going to be ended!\n");
int sig = 15;
KY_PRINTF_STRING_AND_FORMAT_TIME("demo_signal_call_back has received signal [%d]\n", sig);
(结果)
[2022-04-20_14-08-50]The program is going to be ended!
[2022-04-20_14-08-50]demo_signal_call_back has received signal [15]
|