2010-03-09 06:06:13 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package Include/help/ja
|
|
|
|
*/
|
|
|
|
?>
|
|
|
|
<h1>日時データソース</h1>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
日時データソースに、システムの日時データかデータベースに記録されているデータかどちらをを利用するかを定義します。<br /><br />
|
|
|
|
</p>
|
|
|
|
<p>
|
2019-01-30 16:18:44 +01:00
|
|
|
これは、データベースがウェブサーバや <?php echo get_product_name(); ?> サーバと異なるサーバで動作している場合で、時刻にずれが生じている場合に便利です。
|
|
|
|
すべての <?php echo get_product_name(); ?> サーバと MySQL サーバの時刻は NTP により同期すべきですが、この設定を利用することにより、必ずしもそうする必要がなくなります。
|
2010-03-09 06:06:13 +01:00
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
注: データベースではクエリがキャッシュされますが、内部関数が呼ばれるかどうかに関わらずその時点のシステムタイムが返されますので、日時データは若干異なる場合があります。
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
以下の例は、現在の日時を異なるデータソースから表示しています。
|
|
|
|
<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
|
2019-01-30 16:18:44 +01:00
|
|
|
$option = ['prominent' => 'timestamp'];
|
2010-03-09 06:06:13 +01:00
|
|
|
?>
|
2019-01-30 16:18:44 +01:00
|
|
|
<b>現在のシステムの時刻:</b> <?php ui_print_timestamp(time(), false, $option); ?>
|
2010-03-09 06:06:13 +01:00
|
|
|
<br />
|
2011-03-04 Miguel de Dios <miguel.dedios@artica.es>
* include/db/postgresql.php, include/db/mysql.php, include/functions_db.php:
the function "get_system_time" and derivate functions in DB engines.
* include/functions_gis.php, include/functions_servers.php,
include/help/en/help_timesource.php, include/help/es/help_timesource.php,
include/help/ja/help_timesource.php, include/functions.php,
operation/agentes/estado_agente.php, operation/agentes/gis_view.php,
operation/gis_maps/render_view.php: added the SQL queries PostgreSQL
compatible, in this case with the function to get unix_timestamp.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4058 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-04 13:36:23 +01:00
|
|
|
<b>現在のデータベースの時刻:</b>
|
|
|
|
<?php
|
|
|
|
global $config;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
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;
|
2011-03-04 Miguel de Dios <miguel.dedios@artica.es>
* include/db/postgresql.php, include/db/mysql.php, include/functions_db.php:
the function "get_system_time" and derivate functions in DB engines.
* include/functions_gis.php, include/functions_servers.php,
include/help/en/help_timesource.php, include/help/es/help_timesource.php,
include/help/ja/help_timesource.php, include/functions.php,
operation/agentes/estado_agente.php, operation/agentes/gis_view.php,
operation/gis_maps/render_view.php: added the SQL queries PostgreSQL
compatible, in this case with the function to get unix_timestamp.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4058 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-04 13:36:23 +01:00
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
ui_print_timestamp($timestamp, false, $option);
|
2011-03-04 Miguel de Dios <miguel.dedios@artica.es>
* include/db/postgresql.php, include/db/mysql.php, include/functions_db.php:
the function "get_system_time" and derivate functions in DB engines.
* include/functions_gis.php, include/functions_servers.php,
include/help/en/help_timesource.php, include/help/es/help_timesource.php,
include/help/ja/help_timesource.php, include/functions.php,
operation/agentes/estado_agente.php, operation/agentes/gis_view.php,
operation/gis_maps/render_view.php: added the SQL queries PostgreSQL
compatible, in this case with the function to get unix_timestamp.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4058 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-04 13:36:23 +01:00
|
|
|
?>
|
2010-03-09 06:06:13 +01:00
|
|
|
<br />
|
|
|
|
<b>あなたのブラウザの時刻:</b> <script type="text/javascript">document.write (date);</script>
|
|
|
|
</p>
|