浏览代码

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.

master
Matthias Janke 5 年前
父节点
当前提交
efd8184bf0
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3
    0
      radangeld/main.cpp

+ 3
- 0
radangeld/main.cpp 查看文件

79
 	std::chrono::time_point<std::chrono::system_clock> starttime;
79
 	std::chrono::time_point<std::chrono::system_clock> starttime;
80
 	std::chrono::time_point<std::chrono::system_clock> endtime;
80
 	std::chrono::time_point<std::chrono::system_clock> endtime;
81
 
81
 
82
+    std::chrono::time_point<std::chrono::steady_clock> starterrortime;
82
 	std::chrono::time_point<std::chrono::steady_clock> startmeastime;
83
 	std::chrono::time_point<std::chrono::steady_clock> startmeastime;
83
 };
84
 };
84
 
85
 
106
 	libconfig::Setting &measurement = root.add ("Measurement", libconfig::Setting::TypeGroup);
107
 	libconfig::Setting &measurement = root.add ("Measurement", libconfig::Setting::TypeGroup);
107
 
108
 
108
 	measurement.add ("StartTime", libconfig::Setting::TypeString) = date::format ("%F %T ", date::make_zoned (date::current_zone(), mp.starttime) ) + date::current_zone()->name();
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
 	measurement.add ("EndTime", libconfig::Setting::TypeString) = date::format ("%F %T ", date::make_zoned (date::current_zone(), mp.endtime) ) + date::current_zone()->name();
111
 	measurement.add ("EndTime", libconfig::Setting::TypeString) = date::format ("%F %T ", date::make_zoned (date::current_zone(), mp.endtime) ) + date::current_zone()->name();
110
 	measurement.add ("RunAsDaemon", libconfig::Setting::TypeBoolean) = mp.demonize;
112
 	measurement.add ("RunAsDaemon", libconfig::Setting::TypeBoolean) = mp.demonize;
111
 	measurement.add ("MaxIntegrationTime_s", libconfig::Setting::TypeInt) = static_cast<int> (mp.maxduration.count() );
113
 	measurement.add ("MaxIntegrationTime_s", libconfig::Setting::TypeInt) = static_cast<int> (mp.maxduration.count() );
185
 	if (mp.demonize)
187
 	if (mp.demonize)
186
 		sd_notifyf(0, "READY=1\nSTATUS=Processing events…\nMAINPID=%lu", (unsigned long) getpid());
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
 	mp.starttime = std::chrono::system_clock::now();
191
 	mp.starttime = std::chrono::system_clock::now();
189
 	mp.startmeastime = std::chrono::steady_clock::now();
192
 	mp.startmeastime = std::chrono::steady_clock::now();
190
 
193
 

正在加载...
取消
保存