diff --git a/util/dtsc.cpp b/util/dtsc.cpp index 85e1ce47..a5eb05e3 100644 --- a/util/dtsc.cpp +++ b/util/dtsc.cpp @@ -23,6 +23,12 @@ DTSC::Stream::Stream(unsigned int rbuffers){ buffercount = rbuffers; } +/// Returns the time in milliseconds of the last received packet. +/// This is _not_ the time this packet was received, only the stored time. +unsigned int DTSC::Stream::getTime(){ + return buffers.front().getContentP("time")->NumValue(); +} + /// Attempts to parse a packet from the given std::string buffer. /// Returns true if successful, removing the parsed part from the buffer string. /// Returns false if invalid or not enough data is in the buffer. diff --git a/util/dtsc.h b/util/dtsc.h index 3d690d53..f721e6c4 100644 --- a/util/dtsc.h +++ b/util/dtsc.h @@ -129,6 +129,7 @@ namespace DTSC{ std::string & outPacket(unsigned int num); std::string & outHeader(); Ring * getRing(); + unsigned int getTime(); void dropRing(Ring * ptr); private: std::deque buffers;