要求:在弹出视频上左上角显示ubutnu本地时间
关键代码:
std::time_t timestamp = frame_meta->ntp_timestamp / 1000000000;
std::tm * current_time = std::localtime(×tamp);
char strtime[100];
std::strftime(strtime, sizeof(strtime), "%Y-%m-%d %H:%M:%S", current_time);
display_meta = nvds_acquire_display_meta_from_pool(batch_meta);
NvOSD_TextParams *txt_params = &display_meta->text_params[0];
display_meta->num_labels = 1;
txt_params->display_text = (char*)g_malloc0 (MAX_DISPLAY_LEN);
offset = snprintf(txt_params->display_text, MAX_DISPLAY_LEN, "Person = %d ", person_count);
offset = snprintf(txt_params->display_text + offset, MAX_DISPLAY_LEN, strtime);