Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Samples/AdvancedSubscribe.cpp (1 of 5 files). Show all
Unified · Split
| @@ -21,12 +21,9 @@ · 20 unmodified lines | ||
| 21 | 21 | // |
| 22 | 22 | //****************************************************************************************************** |
| 23 | 23 | |
| 24 | −#include <iostream> | |
| 25 | −#include <string> | |
| 26 | −#include <vector> | |
| 27 | − | |
| 28 | 24 | #include "../Common/Convert.h" |
| 29 | 25 | #include "../Transport/DataSubscriber.h" |
| 26 | +#include <iostream> | |
| 30 | 27 | |
| 31 | 28 | using namespace std; |
| 32 | 29 | using namespace GSF; |
| @@ -192,13 +189,9 @@ void SetupSubscriberConnector(SubscriberConnector& connector, const string& host · 159 unmodified lines | ||
| 192 | 189 | // received a new packet of measurements from the publisher. |
| 193 | 190 | void ProcessMeasurements(DataSubscriber* source, const vector<MeasurementPtr>& measurements) |
| 194 | 191 | { |
| 195 | − const string TimestampFormat = "%Y-%m-%d %H:%M:%S.%f"; | |
| 196 | − const uint32_t MaxTimestampSize = 80; | |
| 197 | − | |
| 198 | − static long processCount = 0; | |
| 199 | − static char timestamp[MaxTimestampSize]; | |
| 200 | − static const long interval = 5 * 60; | |
| 201 | − const long measurementCount = measurements.size(); | |
| 192 | + static uint64_t processCount = 0; | |
| 193 | + static const uint64_t interval = 5 * 60; | |
| 194 | + const uint64_t measurementCount = measurements.size(); | |
| 202 | 195 | const bool showMessage = (processCount + measurementCount >= (processCount / interval + 1) * interval); |
| 203 | 196 | |
| 204 | 197 | processCount += measurementCount; |
| @@ -209,14 +202,11 @@ void ProcessMeasurements(DataSubscriber* source, const vector<MeasurementPtr>& m · 4 unmodified lines | ||
| 209 | 202 | stringstream message; |
| 210 | 203 | |
| 211 | 204 | message << source->GetTotalMeasurementsReceived() << " measurements received so far..." << endl; |
| 212 | − | |
| 213 | − if (TicksToString(timestamp, MaxTimestampSize, TimestampFormat, measurements[0]->Timestamp)) | |
| 214 | − message << "Timestamp: " << string(timestamp) << endl; | |
| 215 | − | |
| 216 | − message << "Point\tValue" << endl; | |
| 205 | + message << "Timestamp: " << ToString(measurements[0]->GetDateTime()) << endl; | |
| 206 | + message << "\tPoint\tValue" << endl; | |
| 217 | 207 | |
| 218 | 208 | for (const auto& measurement : measurements) |
| 219 | − message << measurement->ID << '\t' << measurement->Value << endl; | |
| 209 | + message << '\t' << measurement->ID << '\t' << measurement->Value << endl; | |
| 220 | 210 | |
| 221 | 211 | message << endl; |
| 222 | 212 | |