添加系统时间设置
This commit is contained in:
parent
f110779fee
commit
159d15006f
2
third_party/phpcommon
vendored
2
third_party/phpcommon
vendored
@ -1 +1 @@
|
||||
Subproject commit 2ca4273f80ca9a19ddd282e331229ea1b853d372
|
||||
Subproject commit d56fa02411e557908dc2f4f319877a0af70c7957
|
@ -36,4 +36,36 @@ class GMController {
|
||||
return $conn;
|
||||
}
|
||||
|
||||
public function clearDB()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getSysTime()
|
||||
{
|
||||
echo phpcommon\timestamp_to_datetime(phpcommon\getNowTime());
|
||||
}
|
||||
|
||||
public function setSysTime()
|
||||
{
|
||||
if (!defined('GLOBAL_TIME_OFFSET_KEY')) {
|
||||
die('不支持设置系统时间');
|
||||
return;
|
||||
}
|
||||
$newtime = strtotime($_REQUET['newtime']);
|
||||
if ($newtime <= 0) {
|
||||
die('时间格式错误');
|
||||
return;
|
||||
}
|
||||
$time_offset = $newtime - phpcommon\getRealTime();
|
||||
$r = new phpcommon\Redis(array(
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'passwd' => ''
|
||||
|
||||
));
|
||||
$r->set(GLOBAL_TIME_OFFSET_KEY, $time_offset);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user