2 Commits

Author SHA1 Message Date
  Matthias Janke b4aff612b7 radangeldump: changed output formsat ftpm tsv to csv 5 years ago
  Matthias Janke efd8184bf0 timed start measurment time. to syncronize the steady-time with the wall-time the wall-clock call has been surrounded by calls to steady-clock and the half of the difference added as uncertainty parameter, to the config file. 5 years ago
2 changed files with 7 additions and 4 deletions
  1. 3
    0
      radangeld/main.cpp
  2. 4
    4
      radangeldump/main.cpp

+ 3
- 0
radangeld/main.cpp View File

@@ -79,6 +79,7 @@ struct measurement_properties
79 79
 	std::chrono::time_point<std::chrono::system_clock> starttime;
80 80
 	std::chrono::time_point<std::chrono::system_clock> endtime;
81 81
 
82
+    std::chrono::time_point<std::chrono::steady_clock> starterrortime;
82 83
 	std::chrono::time_point<std::chrono::steady_clock> startmeastime;
83 84
 };
84 85
 
@@ -106,6 +107,7 @@ int writeprotocol (const std::string &filename, measurement_properties &mp)
106 107
 	libconfig::Setting &measurement = root.add ("Measurement", libconfig::Setting::TypeGroup);
107 108
 
108 109
 	measurement.add ("StartTime", libconfig::Setting::TypeString) = date::format ("%F %T ", date::make_zoned (date::current_zone(), mp.starttime) ) + date::current_zone()->name();
110
+	measurement.add ("StartTimeError_ns", libconfig::Setting::TypeInt64) = std::chrono::duration_cast<std::chrono::nanoseconds>(mp.startmeastime-mp.starterrortime).count()/2;
109 111
 	measurement.add ("EndTime", libconfig::Setting::TypeString) = date::format ("%F %T ", date::make_zoned (date::current_zone(), mp.endtime) ) + date::current_zone()->name();
110 112
 	measurement.add ("RunAsDaemon", libconfig::Setting::TypeBoolean) = mp.demonize;
111 113
 	measurement.add ("MaxIntegrationTime_s", libconfig::Setting::TypeInt) = static_cast<int> (mp.maxduration.count() );
@@ -185,6 +187,7 @@ void read_hid_reports (measurement_properties &mp, zmqpp::context &zmqc)
185 187
 	if (mp.demonize)
186 188
 		sd_notifyf(0, "READY=1\nSTATUS=Processing events…\nMAINPID=%lu", (unsigned long) getpid());
187 189
                  
190
+    mp.starterrortime = std::chrono::steady_clock::now();
188 191
 	mp.starttime = std::chrono::system_clock::now();
189 192
 	mp.startmeastime = std::chrono::steady_clock::now();
190 193
 

+ 4
- 4
radangeldump/main.cpp View File

@@ -76,9 +76,9 @@ int main(int argc, char *argv[])
76 76
 	zmqpp::message messages;
77 77
 
78 78
     if(events)
79
-        std::cout << "Energy [Ch]\trelative  timestamp[µs]\n";
79
+        std::cout << "\"Energy [Ch]\",\"relative  timestamp[µs]\"\n";
80 80
     else if (cpm)
81
-        std::cout << "relative  timestamp[µs]\tCoutrate [1/min]\n";
81
+        std::cout << "\"relative  timestamp[µs]\",\"Coutrate [1/min]\"\n";
82 82
 
83 83
     do
84 84
     {
@@ -88,14 +88,14 @@ int main(int argc, char *argv[])
88 88
         {
89 89
             messages >> event
90 90
                      >> timestamp;
91
-            std::cout << event << "\t"
91
+            std::cout << event << ","
92 92
                       << timestamp << "\n";
93 93
         }
94 94
         else if(cpm)
95 95
         {
96 96
             messages >> timestamp
97 97
                      >> countrate;
98
-            std::cout << timestamp << "\t"
98
+            std::cout << timestamp << ","
99 99
                       << countrate << "\n";
100 100
         }
101 101
         else

Loading…
Cancel
Save