Browse Source

Z991239-6031 #comment 优化抓拍时获取当前时间信息逻辑

80274480 7 months ago
parent
commit
8ce8291982
1 changed files with 10 additions and 25 deletions
  1. 10 25
      Other/libfacecapture/libfacecapture.cpp

+ 10 - 25
Other/libfacecapture/libfacecapture.cpp

@@ -140,28 +140,6 @@ enum MonitorStateEnum
 	SomebodyOperate			//客户进入操作区域
 };
 
-
-//void GetLocalTimeRVC(SYSTEMTIME& stTime)
-//{
-//#ifdef RVC_OS_WIN
-//	GetLocalTime(&stTime);
-//#else
-//	struct tm* pst = NULL;
-//	time_t t = time(NULL);
-//	pst = localtime(&t);
-//	stTime.wYear = pst->tm_year + 1900;
-//	stTime.wMonth = pst->tm_mon + 1;//because the range of tm_mon is:0-11
-//	stTime.wDay = pst->tm_mday;
-//	stTime.wHour = pst->tm_hour;
-//	stTime.wMinute = pst->tm_min;
-//	stTime.wDayOfWeek = pst->tm_wday;
-//	stTime.wSecond = pst->tm_sec;
-//	stTime.wMilliseconds = 0;
-//
-//	//Dbg("oiltest,time:%d,%d,%d,%d", stTime.wYear, stTime.wHour, stTime.wMinute, stTime.wDayOfWeek);
-//#endif
-//}
-
 class Clibfacecapture_impl
 {
 public:
@@ -2821,9 +2799,16 @@ bool SnapShot(CImageFrame*img)
 	IplImage*cvimgtmp = cvCreateImage(cvSize(img->width,img->height),8,3);
 	IplImage*cvimg = cvCreateImage(cvSize(img->width,img->height),8,3);
 	char m_FileName[MAX_PATH] = {0};
-	//SYSTEMTIME nowTime;                             // 系统时间结构体
-	//GetLocalTimeRVC(nowTime);
-	//sprintf(m_FileName,"%4d%02d%02d%02d%02d%02d",nowTime.wYear,nowTime.wMonth,nowTime.wDay,nowTime.wHour,nowTime.wMinute,nowTime.wSecond); 
+#ifdef _WIN32
+	SYSTEMTIME nowTime;                             // 系统时间结构体
+	GetLocalTime(&nowTime);
+	_snprintf(m_FileName, MAX_PATH, "%4d%02d%02d%02d%02d%02d", nowTime.wYear, nowTime.wMonth, nowTime.wDay, nowTime.wHour, nowTime.wMinute, nowTime.wSecond);
+#else
+	struct tm* pst = NULL;
+	time_t t = time(NULL);
+	pst = localtime(&t);
+	snprintf(m_FileName, MAX_PATH, "%4d%02d%02d%02d%02d%02d", pst->tm_year + 1900, pst->tm_mon + 1, pst->tm_mday, pst->tm_hour, pst->tm_min, pst->tm_wday, pst->tm_sec);
+#endif // _WIN32
 	CvFont	fontEvent = cvFont(2,2);
     memcpy(cvimg->imageData,img->data,img->framesize);
 	int nstartx = 0;