pandorafms/pandora_console/include/help/en/help_timesource.php

62 lines
2.0 KiB
PHP
Raw Normal View History

2009-08-24 Miguel de Dios <miguel.dedios@artica.es> * include/functions_menu.php, include/functions_html.php, include/functions_events.php, include/functions_messages.php, include/functions_modules.php, include/functions_exportserver.php, include/functions_reporting.php, include/functions_filemanager.php, include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php, include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php, include/functions_networkmap.php, include/functions_servers.php, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FusionCharts.php, include/functions_network_profiles.php, include/gettext.php, include/functions_network_components.php, include/functions_visual_map.php, include/fgraph2.php, include/Image/image_functions.php, include/functions_config.php, include/help/en/help_plugin_parameters.php, include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php, include/help/en/help_postprocess.php, include/help/en/help_prediction_source_module.php, include/help/en/help_date_format.php, include/help/en/help_recontask.php, include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php, include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php, include/help/en/help_agent_status.php, include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php, include/help/en/help_alert_type.php, include/help/en/help_network_component.php, include/help/en/help_time_stamp-comparation.php, include/help/en/help_eventview.php, include/help/en/help_timesource.php, include/help/en/help_alert_validation.php, include/help/en/help_map_builder.php, include/help/en/help_alert_recovery.php, include/help/en/help_module_type.php, include/help/en/help_planned_downtime.php, include/help/en/help_serverlag.php, include/help/en/help_alerts.php, include/help/en/help_snmpwalk.php, include/help/en/help_module_definition.php, include/help/en/help_plugin_definition.php, include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php include/help/en/help_manageconfig.php, include/help/es/help_alert_validation.php, include/help/es/help_plugin_parameters.php, include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php, include/help/es/help_map_builder.php, include/help/es/help_postprocess.php, include/help/es/help_date_format.php, include/help/es/help_alert_recovery.php, include/help/es/help_prediction_source_module.php, include/help/es/help_module_type.php, include/help/es/help_planned_downtime.php, include/help/es/help_alert-matches.php, include/help/es/help_recontask.php, include/help/es/help_alerts.php, include/help/es/help_serverlag.php, include/help/es/help_snmpwalk.php, include/help/es/help_module_definition.php, include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php, include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php, include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php, include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php, include/help/es/help_wminamespace.php, include/help/es/help_network_component.php, include/help/es/help_time_stamp-comparation.php, include/help/es/help_manageconfig.php, include/help/es/help_timesource.php, include/config_process.php, include/functions_ui.php, include/htmlawed.php, include/functions_custom_graphs.php, include/fgraph.php, include/functions_incidents.php, include/functions.php, include/functions_agents.php, include/functions_db.php, include/functions_themes.php, include/streams.php, include/functions_fsgraph.php, include/functions_alerts.php, include/functions_reports.php, include/functions_extensions.php, include/functions_ui_renders.php: change comments blocks for delete the warnings to construct phpDoc Files, give a struct and order in the phpDoc files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
<?php
/**
* @package Include/help/en
*/
?>
<h1>Time Source</h1>
<p>
What source to use for the time. This can be (for now) either the local system (System) or database (Database).<br />
</p>
<p>
This is useful when your database is not on the same system as your webserver or your <?php echo get_product_name(); ?> servers.
In that case any time difference will miscalculate the time differences and timestamps.
You should use NTP to sync all your <?php echo get_product_name(); ?> servers and your MySQL server.
By using these preferences you don't have to sync your webserver but it's still recommended.
</p>
<p>
Feel free to implement more sources (eg: ntp, ldap, $_SERVER...).
</p>
<p>
Note: The database query will be cached the first time it's called so the time will always be the same on a page load throughout, while System time is returned whenever the function is called, which might differ slightly (especially near the ending of a second).
</p>
<p>
These examples are all returning Unixtime
<script type="text/javascript">
var date = new Date; // Generic JS date object
var unixtime_ms = date.getTime(); // Returns milliseconds since the epoch
var unixtime = parseInt(unixtime_ms / 1000);
</script>
</p>
<p>
<?php
$option = ['prominent' => 'timestamp'];
?>
<b>Current System time:</b> <?php ui_print_timestamp(time(), false, $option); ?>
<br />
<b>Current Database time:</b>
<?php
global $config;
switch ($config['dbtype']) {
case 'mysql':
$timestamp = db_process_sql('SELECT UNIX_TIMESTAMP();');
$timestamp = $timestamp[0]['UNIX_TIMESTAMP()'];
break;
case 'postgresql':
$timestamp = db_get_value_sql("SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP));");
break;
case 'oracle':
$timestamp = db_process_sql("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) as dt FROM dual");
$timestamp = $timestamp[0]['dt'];
break;
}
ui_print_timestamp($timestamp, false, $option);
?>
<br />
<b>Your browser time:</b> <script type="text/javascript">document.write (date);</script>
</p>