Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Samples/SimpleSubscribe.cpp (1 of 5 files). Show all
Unified · Split
| @@ -21,13 +21,10 @@ · 20 unmodified lines | |||
| 21 | // | 21 | // |
| 22 | //****************************************************************************************************** | 22 | //****************************************************************************************************** |
| 23 | 23 | ||
| 24 | #include <iostream> | ||
| 25 | #include <string> | ||
| 26 | #include <vector> | ||
| 27 | |||
| 28 | #include "../Common/CommonTypes.h" | 24 | #include "../Common/CommonTypes.h" |
| 29 | #include "../Common/Convert.h" | 25 | #include "../Common/Convert.h" |
| 30 | #include "../Transport/DataSubscriber.h" | 26 | #include "../Transport/DataSubscriber.h" |
| 27 | #include <iostream> | ||
| 31 | 28 | ||
| 32 | using namespace std; | 29 | using namespace std; |
| 33 | using namespace GSF; | 30 | using namespace GSF; |
| @@ -145,11 +142,7 @@ bool RunSubscriber(const string& hostname, uint16_t port) · 111 unmodified lines | |||
| 145 | // received a new packet of measurements from the publisher. | 142 | // received a new packet of measurements from the publisher. |
| 146 | void ProcessMeasurements(DataSubscriber* source, const vector<MeasurementPtr>& measurements) | 143 | void ProcessMeasurements(DataSubscriber* source, const vector<MeasurementPtr>& measurements) |
| 147 | { | 144 | { |
| 148 | const string TimestampFormat = "%Y-%m-%d %H:%M:%S.%f"; | ||
| 149 | const uint32_t MaxTimestampSize = 80; | ||
| 150 | |||
| 151 | static long processCount = 0; | 145 | static long processCount = 0; |
| 152 | static char timestamp[MaxTimestampSize]; | ||
| 153 | static const long interval = 5 * 60; | 146 | static const long interval = 5 * 60; |
| 154 | const long measurementCount = measurements.size(); | 147 | const long measurementCount = measurements.size(); |
| 155 | const bool showMessage = (processCount + measurementCount >= (processCount / interval + 1) * interval); | 148 | const bool showMessage = (processCount + measurementCount >= (processCount / interval + 1) * interval); |
| @@ -162,10 +155,7 @@ void ProcessMeasurements(DataSubscriber* source, const vector<MeasurementPtr>& m · 6 unmodified lines | |||
| 162 | stringstream message; | 155 | stringstream message; |
| 163 | 156 | ||
| 164 | message << source->GetTotalMeasurementsReceived() << " measurements received so far..." << endl; | 157 | message << source->GetTotalMeasurementsReceived() << " measurements received so far..." << endl; |
| 165 | 158 | message << "Timestamp: " << ToString(measurements[0]->GetDateTime()) << endl; | |
| 166 | if (TicksToString(timestamp, MaxTimestampSize, TimestampFormat, measurements[0]->Timestamp)) | ||
| 167 | message << "Timestamp: " << string(timestamp) << endl; | ||
| 168 | |||
| 169 | message << "Point\tValue" << endl; | 159 | message << "Point\tValue" << endl; |
| 170 | 160 | ||
| 171 | for (const auto& measurement : measurements) | 161 | for (const auto& measurement : measurements) |