diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index fce858a..2eda4f8 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -281,12 +281,15 @@ std::vector AlprImpl::recognize(cv::Mat img, std::vector r return rectRegions; } -string AlprImpl::toJson(const vector< AlprResult > results, double processing_time_ms) +string AlprImpl::toJson(const vector 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 ); diff --git a/src/openalpr/alpr_impl.h b/src/openalpr/alpr_impl.h index 2b518be..2c1d1f4 100644 --- a/src/openalpr/alpr_impl.h +++ b/src/openalpr/alpr_impl.h @@ -79,7 +79,7 @@ class AlprImpl void setTopN(int topn); void setDefaultRegion(std::string region); - std::string toJson(const std::vector results, double processing_time_ms = -1); + std::string toJson(const std::vector results, double processing_time_ms = -1, long epoch_time = -1); static std::string getVersion(); Config* config;