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