|
|
|
|
@ -288,25 +288,25 @@ void MainWindow::wind_close_ntp(){
|
|
|
|
|
|
|
|
|
|
void MainWindow::stop_ntp(){
|
|
|
|
|
string cmd = "SEL_SERVICE=\"systemd-timesyncd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service; ";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
cmd ="SEL_SERVICE=\"ntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
cmd ="SEL_SERVICE=\"ntpdate\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
cmd = "SEL_SERVICE=\"chronyd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
cmd ="SEL_SERVICE=\"openntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ntpd; ";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
cmd ="SEL_SERVICE=\"ptp4l\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
cmd ="SEL_SERVICE=\"phc2sys\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE} ";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::hardware_clock(){
|
|
|
|
|
string cmd = "hwclock --systohc";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::gui_mess_close(){
|
|
|
|
|
@ -354,7 +354,7 @@ void MainWindow::event_entry_cbDhcp(){
|
|
|
|
|
if (activ_index==0){
|
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
|
string cmd = "/usr/bin/ubconfig set network NTPSERVERS=default";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
cbDhcp->set_active(activ_index);
|
|
|
|
|
string response = this->call("/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT");
|
|
|
|
|
@ -364,7 +364,7 @@ void MainWindow::event_entry_cbDhcp(){
|
|
|
|
|
else if (activ_index==1){
|
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
|
string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
cbDhcp->set_active(activ_index);
|
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
|
@ -387,7 +387,7 @@ void MainWindow::event_entry_cbDhcp(){
|
|
|
|
|
}
|
|
|
|
|
else if (activ_index==3){
|
|
|
|
|
string cmd = "/usr/bin/ubconfig remove network NTPSERVERS";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
btnUpdateDateTime->set_sensitive(true);
|
|
|
|
|
@ -397,7 +397,7 @@ void MainWindow::event_entry_cbDhcp(){
|
|
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
cbDhcp->set_active(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -465,7 +465,9 @@ void MainWindow::enry_dhcp_mess(){
|
|
|
|
|
else if (str_dhcp=="default"){
|
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
|
cbDhcp->set_active(0);
|
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
|
string response = this->call("/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT");
|
|
|
|
|
this->str_remove(response, "\n");
|
|
|
|
|
txtNtpServer->set_text(response);
|
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
@ -551,7 +553,7 @@ void MainWindow::enter_zone(){
|
|
|
|
|
str_region=reg_text;
|
|
|
|
|
string cmd = "";
|
|
|
|
|
cmd = " ubconfig --target system set clock ZONE=" + str_region + "/" + str_zone;
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
str_zone="";
|
|
|
|
|
@ -589,7 +591,7 @@ void MainWindow::enter_zone_glob(){
|
|
|
|
|
if (!(zone_text.empty())){
|
|
|
|
|
//str_zoneGlob = zone_text.substr(zone_text.find(") ")+2,zone_text.length());
|
|
|
|
|
string cmd = "/usr/bin/ubconfig --target global set clock ZONE=" +reg_text +"/" + zone_text;
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
str_zoneGlob="";
|
|
|
|
|
@ -709,7 +711,7 @@ void MainWindow::update_time_date(){
|
|
|
|
|
if (str_data==str_data_entry){
|
|
|
|
|
cmd = "date +%Y%m%d -s \"" + to_string(year)+
|
|
|
|
|
str_month+str_day+"\"";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
txtDate->set_text(str_data);
|
|
|
|
|
year=0;
|
|
|
|
|
month=0;
|
|
|
|
|
@ -729,7 +731,7 @@ void MainWindow::update_time_date(){
|
|
|
|
|
cmd = "date +%T -s \""+
|
|
|
|
|
to_string(hour) + ":" + to_string(minute)
|
|
|
|
|
+ ":" + to_string(ltm->tm_sec) +"\"";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
response_cmd=system(cmd.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::post_entry_data(){
|
|
|
|
|
|