mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 03:32:56 +08:00
Added epoch time to json output
This commit is contained in:
@@ -294,6 +294,7 @@ cJSON* AlprImpl::createJsonObj(const AlprResult* result)
|
|||||||
root=cJSON_CreateObject();
|
root=cJSON_CreateObject();
|
||||||
|
|
||||||
cJSON_AddStringToObject(root,"plate", result->bestPlate.characters.c_str());
|
cJSON_AddStringToObject(root,"plate", result->bestPlate.characters.c_str());
|
||||||
|
cJSON_AddNumberToObject(root,"epoch_time", getEpochTime() );
|
||||||
cJSON_AddNumberToObject(root,"confidence", result->bestPlate.overall_confidence);
|
cJSON_AddNumberToObject(root,"confidence", result->bestPlate.overall_confidence);
|
||||||
cJSON_AddNumberToObject(root,"matches_template", result->bestPlate.matches_template);
|
cJSON_AddNumberToObject(root,"matches_template", result->bestPlate.matches_template);
|
||||||
|
|
||||||
|
@@ -139,3 +139,9 @@ timespec diff(timespec start, timespec end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
int getEpochTime()
|
||||||
|
{
|
||||||
|
return std::time(0);
|
||||||
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
#define TIMING_H
|
#define TIMING_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
// Support for OS X
|
// Support for OS X
|
||||||
#ifdef __MACH__
|
#ifdef __MACH__
|
||||||
@@ -19,4 +20,6 @@
|
|||||||
void getTime(timespec* time);
|
void getTime(timespec* time);
|
||||||
double diffclock(timespec time1,timespec time2);
|
double diffclock(timespec time1,timespec time2);
|
||||||
|
|
||||||
|
int getEpochTime();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user