pvxmonitor show dis/connect time

This commit is contained in:
Michael Davidsaver committed 2026-06-28 20:05:45 -07:00
1 parent 32b9905bb8
commit 086501a1b0
1 file changed
+15 -2
+15 -2
View File
@@ -13,12 +13,25 @@
#include <epicsVersion.h>
#include <epicsGetopt.h>
#include <epicsThread.h>
#include <epicsTime.h>
#include <pvxs/client.h>
#include <pvxs/log.h>
#include "utilpvt.h"
#include "evhelper.h"
#if EPICS_VERSION_INT < VERSION_INT(7, 0, 6, 1)
static inline
std::ostream& operator<<(std::ostream& strm, const epicsTime& ts)
{
char temp[64];
(void)ts.strftime(temp, sizeof(temp), "%Y-%m-%d %H:%M:%S.%09f");
temp[sizeof(temp)-1u] = '\0';
return strm<<temp;
}
#endif
using namespace pvxs;
namespace {
@@ -152,7 +165,7 @@ int main(int argc, char *argv[])
remaining--;
}catch(client::Connected& conn) {
std::cerr<<name.c_str()<<" Connected to "<<conn.peerName<<"\n";
std::cerr<<conn.time<<" "<<name.c_str()<<" Connected to "<<conn.peerName<<"\n";
if(app.test(Level::Debug)) {
client::SubscriptionStat stats;
mon->stats(stats);
@@ -160,7 +173,7 @@ int main(int argc, char *argv[])
}
}catch(client::Disconnect& conn) {
std::cerr<<name.c_str()<<" Disconnected\n";
std::cerr<<conn.time<<" "<<name.c_str()<<" Disconnected\n";
}catch(std::exception& err) {
std::cerr<<name.c_str()<<" Error "<<typeid (err).name()<<" : "<<err.what()<<"\n";