Author: jsuchome Date: Thu Sep 2 11:24:07 2010 New Revision: 62466 URL: http://svn.opensuse.org/viewcvs/yast?rev=62466&view=rev Log: - provide public API for info about time synchronization without daemon running (bnc#627818) - 2.20.0 Modified: trunk/ntp-client/VERSION trunk/ntp-client/package/yast2-ntp-client.changes trunk/ntp-client/src/NtpClient.ycp trunk/ntp-client/src/ntp-client_proposal.ycp Modified: trunk/ntp-client/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/VERSION?rev=62466&r1=62465&r2=62466&view=diff ============================================================================== --- trunk/ntp-client/VERSION (original) +++ trunk/ntp-client/VERSION Thu Sep 2 11:24:07 2010 @@ -1 +1 @@ -2.18.1 +2.20.0 Modified: trunk/ntp-client/package/yast2-ntp-client.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/package/yast2-ntp-client.changes?rev=62466&r1=62465&r2=62466&view=diff ============================================================================== --- trunk/ntp-client/package/yast2-ntp-client.changes (original) +++ trunk/ntp-client/package/yast2-ntp-client.changes Thu Sep 2 11:24:07 2010 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Thu Sep 2 11:21:09 CEST 2010 - jsuchome@suse.cz + +- provide public API for info about time synchronization without + daemon running (bnc#627818) +- 2.20.0 + +------------------------------------------------------------------- Fri Apr 9 15:24:42 UTC 2010 - varkoly@novell.com - Initial version of time synchronization without running ntp as deamon Modified: trunk/ntp-client/src/NtpClient.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/src/NtpClient.ycp?rev=62466&r1=62465&r2=62466&view=diff ============================================================================== --- trunk/ntp-client/src/NtpClient.ycp (original) +++ trunk/ntp-client/src/NtpClient.ycp Thu Sep 2 11:24:07 2010 @@ -434,6 +434,28 @@ } /** + * Read the synchronization status, fill + * synchronize_time and sync_interval variables + * Return updated value of synchronize_time + */ +global boolean ReadSynchronization () { + + list crontab = (list)SCR::Read(.cron, cron_file, ""); + y2milestone("CRONTAB %1", crontab); + string tmp = (string) crontab[0,"events",0,"active"]:"0"; + synchronize_time = tmp == "1"; + tmp = (string) crontab[0,"events",0,"minute"]:"*/5"; + y2milestone("MINUTE %1", tmp); + list pos = regexppos(tmp, "[0-9]+"); + string tmp2 = substring(tmp,pos[0]:0,pos[1]:0); + sync_interval = tointeger(tmp2); + y2milestone("SYNC_INTERVAL %1", sync_interval); + + return synchronize_time; +} + + +/** * Read all ntp-client settings * @return true on success */ @@ -518,16 +540,8 @@ if (! Mode::commandline() && ! FileChanges::CheckFiles (["/etc/ntp.conf"])) failed = true; ProcessNtpConf(); - list crontab = (list)SCR::Read(.cron, cron_file, ""); - y2milestone("CRONTAB %1", crontab); - string tmp = (string) crontab[0,"events",0,"active"]:"0"; - synchronize_time = tmp == "1"; - tmp = (string) crontab[0,"events",0,"minute"]:"*/5"; - y2milestone("MINUTE %1", tmp); - list pos = regexppos(tmp, "[0-9]+"); - string tmp2 = substring(tmp,pos[0]:0,pos[1]:0); - sync_interval = tointeger(tmp2); - y2milestone("SYNC_INTERVAL %1", sync_interval); + + ReadSynchronization (); string run_chroot_s = (string) SCR::Read (.sysconfig.ntp.NTPD_RUN_CHROOTED); run_chroot = run_chroot_s == "yes"; Modified: trunk/ntp-client/src/ntp-client_proposal.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/src/ntp-client_proposal.ycp?rev=62466&r1=62465&r2=62466&view=diff ============================================================================== --- trunk/ntp-client/src/ntp-client_proposal.ycp (original) +++ trunk/ntp-client/src/ntp-client_proposal.ycp Thu Sep 2 11:24:07 2010 @@ -77,7 +77,11 @@ } boolean GetNTPEnabled () { - return Service::Enabled (NtpClient::service_name); + + if (!Stage::initial()) + NtpClient::ReadSynchronization (); + + return NtpClient::synchronize_time || Service::Enabled (NtpClient::service_name); } boolean ValidateSingleServer( string ntp_server ) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org