From efe357e8ead5b650c8fe8513acfec3041b44721d Mon Sep 17 00:00:00 2001 From: Jan Grewe Date: Wed, 10 Jun 2020 10:48:26 +0200 Subject: [PATCH] [myimage] expose frame timestamps --- myimage.cpp | 5 ++++- myimage.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/myimage.cpp b/myimage.cpp index e88d572..0625002 100644 --- a/myimage.cpp +++ b/myimage.cpp @@ -16,7 +16,7 @@ bool MyImage::setFrame(Pylon::CGrabResultPtr ptr) { img_height = ptr->GetHeight(); memcpy(&buffer, ptr->GetBuffer(), ptr->GetImageSize()); auto t = std::chrono::system_clock::now(); - timestamp = std::chrono::system_clock::to_time_t(t); + img_timestamp = std::chrono::system_clock::to_time_t(t); } return valid; } @@ -41,3 +41,6 @@ void *MyImage::data() { return &buffer; } +time_t MyImage::timestamp() { + return img_timestamp; +} diff --git a/myimage.h b/myimage.h index 81183db..7d5ea32 100644 --- a/myimage.h +++ b/myimage.h @@ -14,13 +14,14 @@ public: int size(); int64_t index(); void* data(); + time_t timestamp(); bool setFrame(Pylon::CGrabResultPtr ptr); private: uint32_t img_width = 0; uint32_t img_height = 0; int64_t img_index = 0; - time_t timestamp; + time_t img_timestamp; static const int max_width = 2048; static const int max_height = 1536; char buffer[max_width * max_height];