Added epoch_time as an optional value for json serializing

This commit is contained in:
Matt Hill
2014-09-30 22:34:06 -04:00
parent 8ef633a43b
commit 3585e0436f
2 changed files with 6 additions and 3 deletions

View File

@@ -281,12 +281,15 @@ std::vector<AlprResult> AlprImpl::recognize(cv::Mat img, std::vector<cv::Rect> r
return rectRegions;
}
string AlprImpl::toJson(const vector< AlprResult > results, double processing_time_ms)
string AlprImpl::toJson(const vector<AlprResult > results, double processing_time_ms, long epoch_time)
{
cJSON *root, *jsonResults;
root = cJSON_CreateObject();
cJSON_AddNumberToObject(root,"epoch_time", getEpochTime() );
if (epoch_time <= 0)
epoch_time = getEpochTime();
cJSON_AddNumberToObject(root,"epoch_time", epoch_time );
if (processing_time_ms >= 0)
{
cJSON_AddNumberToObject(root,"processing_time_ms", processing_time_ms );