서버 시간을 더 정교하게 반영하도록 수정
This commit is contained in:
+2
-1
@@ -20,6 +20,7 @@ function myCommandList() {
|
|||||||
$userID = Session::getUserID();
|
$userID = Session::getUserID();
|
||||||
|
|
||||||
$date = date('Y-m-d H:i:s');
|
$date = date('Y-m-d H:i:s');
|
||||||
|
$date_precise = (new \DateTime())->format("Y-m-d H:i:s.u");
|
||||||
|
|
||||||
// 명령 목록
|
// 명령 목록
|
||||||
$admin = $gameStor->getValues(['year','month','turnterm','turntime','opentime']);
|
$admin = $gameStor->getValues(['year','month','turnterm','turntime','opentime']);
|
||||||
@@ -33,7 +34,7 @@ function myCommandList() {
|
|||||||
|
|
||||||
echo "<table width=300 height=700 class='tb_layout bg2'>
|
echo "<table width=300 height=700 class='tb_layout bg2'>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=4 align=center id=bg0><b>- 명령 목록 - <input value='$date' type=text id=clock size=19 style=background-color:black;color:white;border-style:none;></b></td>
|
<td colspan=4 align=center id=bg0><b>- 명령 목록 - <input value='$date' type=text id=clock size=19 style=background-color:black;color:white;border-style:none; data-server-time='{$date_precise}'></b></td>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
$year = $admin['year'];
|
$year = $admin['year'];
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ $serverCnt = $db->queryFirstField('SELECT count(*) FROM ng_games');
|
|||||||
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
|
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
|
||||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||||
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
|
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
|
||||||
<?=WebUtil::printJS('../e_lib/moment-timezone-with-data-10-year-range.min.js')?>
|
|
||||||
<?=WebUtil::printJS('../e_lib/linkify/linkify.min.js')?>
|
<?=WebUtil::printJS('../e_lib/linkify/linkify.min.js')?>
|
||||||
<?=WebUtil::printJS('../e_lib/linkify/linkify-string.min.js')?>
|
<?=WebUtil::printJS('../e_lib/linkify/linkify-string.min.js')?>
|
||||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||||
|
|||||||
+12
-2
@@ -66,11 +66,21 @@ function reloadCommandList(){
|
|||||||
|
|
||||||
function myclock() {
|
function myclock() {
|
||||||
|
|
||||||
$('#clock').val(moment().tz('Asia/Seoul').format('YYYY-MM-DD HH:mm:ss'));
|
var $clock = $('#clock');
|
||||||
|
var now_clock = moment();
|
||||||
|
|
||||||
|
if(!$clock.attr('data-time-diff')){
|
||||||
|
var base_clock = moment($clock.attr('data-server-time'));
|
||||||
|
$clock.attr('data-time-diff', base_clock.diff(now_clock));
|
||||||
|
}
|
||||||
|
|
||||||
|
var game_clock = now_clock.add(parseInt($clock.attr('data-time-diff')), 'milliseconds');
|
||||||
|
|
||||||
|
$('#clock').val(game_clock.format('YYYY-MM-DD HH:mm:ss'));
|
||||||
|
|
||||||
window.setTimeout(function(){
|
window.setTimeout(function(){
|
||||||
myclock();
|
myclock();
|
||||||
}, 1000);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery(function($){
|
jQuery(function($){
|
||||||
|
|||||||
Reference in New Issue
Block a user