Revision b993931c
Added by sbeaver about 10 years ago
usr/local/www/services_ntpd_pps.php | ||
---|---|---|
43 | 43 |
|
44 | 44 |
if (!is_array($config['ntpd'])) |
45 | 45 |
$config['ntpd'] = array(); |
46 |
|
|
46 | 47 |
if (!is_array($config['ntpd']['pps'])) |
47 | 48 |
$config['ntpd']['pps'] = array(); |
48 | 49 |
|
49 | 50 |
if ($_POST) { |
50 |
|
|
51 | 51 |
unset($input_errors); |
52 | 52 |
|
53 | 53 |
if (!$input_errors) { |
... | ... | |
98 | 98 |
$savemsg = get_std_save_message($retval); |
99 | 99 |
} |
100 | 100 |
} |
101 |
|
|
101 | 102 |
$pconfig = &$config['ntpd']['pps']; |
102 | 103 |
|
103 | 104 |
$pgtitle = array(gettext("Services"),gettext("NTP PPS")); |
104 | 105 |
$shortcut_section = "ntp"; |
105 | 106 |
include("head.inc"); |
106 |
?> |
|
107 | 107 |
|
108 |
<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> |
|
109 |
<?php include("fbegin.inc"); ?> |
|
110 |
<form action="services_ntpd_pps.php" method="post" name="iform" id="iform"> |
|
111 |
<?php if ($input_errors) print_input_errors($input_errors); ?> |
|
112 |
<?php if ($savemsg) print_info_box($savemsg); ?> |
|
108 |
if ($input_errors) |
|
109 |
print_input_errors($input_errors); |
|
110 |
|
|
111 |
if ($savemsg) |
|
112 |
print_info_box($savemsg, 'success'); |
|
113 |
|
|
114 |
$tab_array = array(); |
|
115 |
$tab_array[] = array(gettext("NTP"), false, "services_ntpd.php"); |
|
116 |
$tab_array[] = array(gettext("Serial GPS"), false, "services_ntpd_gps.php"); |
|
117 |
$tab_array[] = array(gettext("PPS"), true, "services_ntpd_pps.php"); |
|
118 |
display_top_tabs($tab_array); |
|
119 |
|
|
120 |
require('classes/Form.class.php'); |
|
121 |
|
|
122 |
$form = new Form; |
|
123 |
|
|
124 |
$section = new Form_Section('NTP Serial PPS Configuration'); |
|
125 |
|
|
126 |
$section->addInput(new Form_StaticText( |
|
127 |
'Notes', |
|
128 |
'Devices with a Pulse Per Second output such as radios that receive a time signal from DCF77 (DE), JJY (JP), MSF (GB) or WWVB (US) may be used as a PPS reference for NTP.' . |
|
129 |
'A serial GPS may also be used, but the serial GPS driver would usually be the better option. ' . |
|
130 |
'A PPS signal only provides a reference to the change of a second, so at least one other source to number the seconds is required.' . '<br /><br />' . |
|
131 |
'At least 3 additional time sources should be configured under ' . |
|
132 |
'<a href="services_ntpd.php">' . 'Services > NTP' . '</a>' . ' to reliably supply the time of each PPS pulse.' |
|
133 |
)); |
|
134 |
|
|
135 |
$serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE); |
|
136 |
|
|
137 |
if (!empty($serialports)) { |
|
138 |
$splist = array(); |
|
139 |
|
|
140 |
foreach ($serialports as $port) { |
|
141 |
$shortport = substr($port,5); |
|
142 |
$splist[$shortport] = $shortport; |
|
143 |
} |
|
144 |
|
|
145 |
$section->addInput(new Form_Select( |
|
146 |
'ppsport', |
|
147 |
'Serial port', |
|
148 |
$pconfig['port'], |
|
149 |
$splist |
|
150 |
))->setHelp('All serial ports are listed, be sure to pick the port with the PPS source attached. '); |
|
151 |
} |
|
113 | 152 |
|
114 |
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ntpd pps"> |
|
115 |
<tr> |
|
116 |
<td> |
|
117 |
<?php |
|
118 |
$tab_array = array(); |
|
119 |
$tab_array[] = array(gettext("NTP"), false, "services_ntpd.php"); |
|
120 |
$tab_array[] = array(gettext("Serial GPS"), false, "services_ntpd_gps.php"); |
|
121 |
$tab_array[] = array(gettext("PPS"), true, "services_ntpd_pps.php"); |
|
122 |
display_top_tabs($tab_array); |
|
123 |
?> |
|
124 |
</td> |
|
125 |
</tr> |
|
126 |
<tr> |
|
127 |
<td> |
|
128 |
<div id="mainarea"> |
|
129 |
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area"> |
|
130 |
<tr> |
|
131 |
<td colspan="2" valign="top" class="listtopic"><?=gettext("NTP PPS Configuration"); ?></td> |
|
132 |
</tr> |
|
133 |
<tr> |
|
134 |
<td width="22%" valign="top" class="vncellreq"> |
|
135 |
</td> |
|
136 |
<td width="78%" class="vtable"><?php echo gettext("Devices with a Pulse Per Second output such as radios that receive a time signal from DCF77 (DE), JJY (JP), MSF (GB) or WWVB (US) may be used as a PPS reference for NTP.");?> |
|
137 |
<?php echo gettext("A serial GPS may also be used, but the serial GPS driver would usually be the better option.");?> |
|
138 |
<?php echo gettext("A PPS signal only provides a reference to the change of a second, so at least one other source to number the seconds is required.");?> |
|
139 |
<br /> |
|
140 |
<br /><strong><?php echo gettext("Note");?>:</strong> <?php echo gettext("At least 3 additional time sources should be configured under"); ?> <a href="services_ntpd.php"><?php echo gettext("Services > NTP"); ?></a> <?php echo gettext("to reliably supply the time of each PPS pulse."); ?> |
|
141 |
</td> |
|
142 |
</tr> |
|
143 |
<?php $serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE); ?> |
|
144 |
<?php if (!empty($serialports)): ?> |
|
145 |
<tr> |
|
146 |
<td width="22%" valign="top" class="vncellreq">Serial port</td> |
|
147 |
<td width="78%" class="vtable"> |
|
148 |
<select name="ppsport" class="formselect"> |
|
149 |
<option value="">none</option> |
|
150 |
<?php foreach ($serialports as $port): |
|
151 |
$shortport = substr($port,5); |
|
152 |
$selected = ($shortport == $pconfig['port']) ? " selected=\"selected\"" : "";?> |
|
153 |
<option value="<?php echo $shortport;?>"<?php echo $selected;?>><?php echo $shortport;?></option> |
|
154 |
<?php endforeach; ?> |
|
155 |
</select> |
|
156 |
<?php echo gettext("All serial ports are listed, be sure to pick the port with the PPS source attached."); ?> |
|
157 |
</td> |
|
158 |
</tr> |
|
159 |
<?php endif; ?> |
|
160 |
<tr> |
|
161 |
<td width="22%" valign="top" class="vncellreq">Fudge time</td> |
|
162 |
<td width="78%" class="vtable"> |
|
163 |
<input name="ppsfudge1" type="text" class="formfld unknown" id="ppsfudge1" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge1']);?>" />(<?php echo gettext("seconds");?>)<br /> |
|
164 |
<?php echo gettext("Fudge time is used to specify the PPS signal offset from the actual second such as the transmission delay between the transmitter and the receiver.");?> (<?php echo gettext("default");?>: 0.0).</td> |
|
165 |
</tr> |
|
166 |
<tr> |
|
167 |
<td width="22%" valign="top" class="vncellreq">Stratum</td> |
|
168 |
<td width="78%" class="vtable"> |
|
169 |
<input name="ppsstratum" type="text" class="formfld unknown" id="ppsstratum" max="16" size="20" value="<?=htmlspecialchars($pconfig['stratum']);?>" /><?php echo gettext("(0-16)");?><br /> |
|
170 |
<?php echo gettext("This may be used to change the PPS Clock stratum");?> (<?php echo gettext("default");?>: 0). <?php echo gettext("This may be useful if, for some reason, you want ntpd to prefer a different clock and just monitor this source."); ?></td> |
|
171 |
</tr> |
|
172 |
<tr> |
|
173 |
<td width="22%" valign="top" class="vncellreq">Flags</td> |
|
174 |
<td width="78%" class="vtable"> |
|
175 |
<table summary="flags"> |
|
176 |
<tr> |
|
177 |
<td> |
|
178 |
<?php echo gettext("Normally there should be no need to change these options from the defaults."); ?><br /> |
|
179 |
</td> |
|
180 |
</tr> |
|
181 |
</table> |
|
182 |
<table> |
|
183 |
<tr> |
|
184 |
<td> |
|
185 |
<input name="ppsflag2" type="checkbox" class="formcheckbox" id="ppsflag2"<?php if($pconfig['flag2']) echo " checked=\"checked\""; ?> /> |
|
186 |
</td> |
|
187 |
<td> |
|
188 |
<span class="vexpl"><?php echo gettext("Enable falling edge PPS signal processing (default: rising edge)."); ?></span> |
|
189 |
</td> |
|
190 |
</tr> |
|
191 |
<tr> |
|
192 |
<td> |
|
193 |
<input name="ppsflag3" type="checkbox" class="formcheckbox" id="ppsflag3"<?php if($pconfig['flag3']) echo " checked=\"checked\""; ?> /> |
|
194 |
</td> |
|
195 |
<td> |
|
196 |
<span class="vexpl"><?php echo gettext("Enable kernel PPS clock discipline (default: disabled)."); ?></span> |
|
197 |
</td> |
|
198 |
</tr> |
|
199 |
<tr> |
|
200 |
<td> |
|
201 |
<input name="ppsflag4" type="checkbox" class="formcheckbox" id="ppsflag4"<?php if($pconfig['flag4']) echo " checked=\"checked\""; ?> /> |
|
202 |
</td> |
|
203 |
<td> |
|
204 |
<span class="vexpl"><?php echo gettext("Record a timestamp once for each second, useful for constructing Allan deviation plots (default: disabled)."); ?></span> |
|
205 |
</td> |
|
206 |
</tr> |
|
207 |
</table> |
|
208 |
</td> |
|
209 |
</tr> |
|
210 |
<tr> |
|
211 |
<td width="22%" valign="top" class="vncellreq">Clock ID</td> |
|
212 |
<td width="78%" class="vtable"> |
|
213 |
<input name="ppsrefid" type="text" class="formfld unknown" id="ppsrefid" maxlength= "4" size="20" value="<?php htmlspecialchars($pconfig['refid']);?>" /><?php echo gettext("(1 to 4 charactors)");?><br /> |
|
214 |
<?php echo gettext("This may be used to change the PPS Clock ID");?> (<?php echo gettext("default");?>: PPS).</td> |
|
215 |
</tr> |
|
216 |
<tr> |
|
217 |
<td width="22%" valign="top"> </td> |
|
218 |
<td width="78%"> |
|
219 |
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> |
|
220 |
</td> |
|
221 |
</tr> |
|
222 |
</table> |
|
223 |
</div> |
|
224 |
</td> |
|
225 |
</tr> |
|
226 |
</table> |
|
227 |
</form> |
|
228 |
<?php include("fend.inc"); ?> |
|
229 |
</body> |
|
230 |
</html> |
|
153 |
$section->addInput(new Form_Input( |
|
154 |
'ppsfudge1', |
|
155 |
'Fudge time', |
|
156 |
'text', |
|
157 |
$pconfig['fudge1'] |
|
158 |
))->setHelp('Fudge time is used to specify the PPS signal offset from the actual second such as the transmission delay between the transmitter and the receiver. (default: 0.0).'); |
|
159 |
|
|
160 |
$section->addInput(new Form_Input( |
|
161 |
'ppsstratum', |
|
162 |
'Stratum', |
|
163 |
'text', |
|
164 |
$pconfig['stratum'] |
|
165 |
))->setHelp('This may be used to change the PPS Clock stratum (default: 0). This may be useful if, for some reason, you want ntpd to prefer a different clock and just monitor this source.'); |
|
166 |
|
|
167 |
$section->addInput(new Form_Checkbox( |
|
168 |
'ppsflag2', |
|
169 |
'Flags', |
|
170 |
'Enable falling edge PPS signal processing (default: rising edge).', |
|
171 |
$pconfig['flag2'] |
|
172 |
)); |
|
173 |
|
|
174 |
$section->addInput(new Form_Checkbox( |
|
175 |
'ppsflag3', |
|
176 |
null, |
|
177 |
'Enable kernel PPS clock discipline (default: disabled).', |
|
178 |
$pconfig['flag3'] |
|
179 |
)); |
|
180 |
|
|
181 |
$section->addInput(new Form_Checkbox( |
|
182 |
'ppsflag4', |
|
183 |
null, |
|
184 |
'Record a timestamp once for each second, useful for constructing Allan deviation plots (default: disabled).', |
|
185 |
$pconfig['flag4'] |
|
186 |
)); |
|
187 |
|
|
188 |
$section->addInput(new Form_Input( |
|
189 |
'ppsrefid', |
|
190 |
'Clock ID', |
|
191 |
'text', |
|
192 |
$pconfig['refid'], |
|
193 |
['placeholder' => '1 to 4 characters'] |
|
194 |
))->setHelp('This may be used to change the PPS Clock ID (default: PPS).'); |
|
195 |
|
|
196 |
$form->add($section); |
|
197 |
print($form); |
|
198 |
|
|
199 |
include("foot.inc"); |
Also available in: Unified diff
services_ntpd_pps.php Conversion complete
Ready for review