分类 Ubuntu 下的文章

“Ubuntu是以桌面应用为主的Linux发行版,基于Debian。Ubuntu有三个正式版本,包括桌面版、服务器版及用于物联网设备和机器人的Core版。从17.10版本开始,Ubuntu以GNOME为默认桌面环境。 Ubuntu是著名的Linux发行版之一,也是目前最多用户的Linux版本。 ”

journalctl usage..
journalctl 用法
journalctl 查看所有日志,基本上就是狂刷

journalctl --no-pager 等于 cat syslog.txt的效果。

journalctl -k

 查看内核日志(不显示应用日志)

加上--no-pager参数就直接输出到标准输出了。

journalctl -k --no-pager 

Jul 29 17:38:47 systemd[1]: systemd-journald.service: Unit entered failed state.
Jul 29 17:38:47 systemd[1]: systemd-journald.service: Failed with result 'signal'.
Jul 29 17:38:47 systemd[1]: systemd-journald.service: Service has no hold-off time, scheduling restart.
Jul 29 17:38:47 systemd[1]: Stopped Flush Journal to Persistent Storage.
Jul 29 17:38:47 systemd[1]: Stopping Flush Journal to Persistent Storage...
Jul 29 17:38:47 systemd[1]: Stopped Journal Service.
Jul 29 17:38:47 systemd[1]: Starting Journal Service...
Jul 29 17:38:47 systemd[1]: Started Journal Service.

查看系统本次启动的日志,基本上就是刷屏了。

journalctl -b
journalctl -b --no-pager 

查看指定程序的日志

journalctl /usr/sbin/sshd --no-pager

Jul 30 10:00:24 sshd[14609]: error: AuthorizedKeysCommand path is not absolute
Jul 30 10:00:24 sshd[14609]: Authentication refused: bad ownership or modes for directory /home/root
Jul 30 10:00:24 sshd[14609]: error: AuthorizedKeysCommand path is not absolute
Jul 30 10:00:24 sshd[14609]: Authentication refused: bad ownership or modes for directory /home/root
Jul 30 10:00:26 sshd[14609]: Accepted password for root from 192.168.5.64 port 52218 ssh2
Jul 30 10:00:26 sshd[14614]: lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
Jul 30 10:00:26 sshd[14614]: lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
Jul 30 10:56:45 sshd[16413]: error: AuthorizedKeysCommand path is not absolute
Jul 30 10:56:45 sshd[16413]: Authentication refused: bad ownership or modes for directory /home/root
Jul 30 10:56:45 sshd[16413]: error: AuthorizedKeysCommand path is not absolute
Jul 30 10:56:45 sshd[16413]: Authentication refused: bad ownership or modes for directory /home/root
Jul 30 10:56:47 sshd[16413]: Accepted password for root from 192.168.5.64 port 55484 ssh2
Jul 30 10:56:47 sshd[16418]: lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
Jul 30 10:56:47 sshd[16418]: lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
Jul 30 11:01:29 sshd[16585]: error: AuthorizedKeysCommand path is not absolute
Jul 30 11:01:29 sshd[16585]: error: AuthorizedKeysCommand path is not absolute
Jul 30 11:01:29 sshd[16585]: Accepted publickey for root from 192.168.5.64 port 55624 ssh2: RSA SHA256:Qji+sVx09n43QcM300pHJiiPWi4KzqulAMkLAaf1vXM
Jul 30 11:01:29 sshd[16587]: lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
Jul 30 11:01:29 sshd[16587]: lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
Jul 30 11:22:15 sshd[17223]: Accepted password for root from 192.168.5.44 port 64448 ssh2
Jul 30 11:22:15 sshd[17228]: lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
Jul 30 11:22:15 sshd[17228]: lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
Jul 30 11:33:52 sshd[17582]: Accepted password for root from 192.168.5.44 port 65228 ssh2
Jul 30 11:36:11 sshd[17696]: Accepted password for root from 192.168.5.44 port 65341 ssh2

journalctl /usr/bin/cv2x-daemon --no-pager

基本上就够用了。

按可执行文件的路径过滤
如果在参数中指定某个可执行文件(二进制文件或脚本文件),则 journalctl 会显示与该可执行文件相关的全部条目。比如可以显示 /usr/lib/systemd/systemd 程序产生的日志:

$ sudo journalctl /usr/lib/systemd/systemd

也可以显示 /usr/bin/bash 程序产生的日志:

$ sudo journalctl /usr/bin/bash

用json输出略吊。。

journalctl /usr/sbin/sshd --no-pager -o json

{ "__CURSOR" : "s=1f967cdb38644934b6add6dca6147120;i=ab550;b=81a1ae5398824daea9b502bf3ddfc092;m=2488403b14;t=5c84eebbadaf5;x=3e575c4f570ffd13", "__REALTIME_TIMESTAMP" : "1627616171449077", "__MONOTONIC_TIMESTAMP" : "156904733460", "_BOOT_ID" : "81a1ae5398824daea9b502bf3ddfc092", "_TRANSPORT" : "syslog", "_UID" : "0", "_GID" : "0", "_CAP_EFFECTIVE" : "3fffffffff", "_MACHINE_ID" : "df9d1eef11ee45fd92b407191b390e56", "_HOSTNAME" : "imx6qsabresd", "PRIORITY" : "6", "SYSLOG_FACILITY" : "4", "SYSLOG_IDENTIFIER" : "sshd", "_COMM" : "sshd", "_EXE" : "/usr/sbin/sshd", "_CMDLINE" : "sshd: root [priv]", "_SYSTEMD_SLICE" : "system-sshd.slice", "SYSLOG_PID" : "17696", "MESSAGE" : "Accepted password for root from 192.168.5.44 port 65341 ssh2", "_PID" : "17696", "_SYSTEMD_CGROUP" : "/system.slice/system-sshd.slice/sshd@57-192.168.5.242:22-192.168.5.44:65341.service", "_SYSTEMD_UNIT" : "sshd@57-192.168.5.242:22-192.168.5.44:65341.service", "_SOURCE_REALTIME_TIMESTAMP" : "1627616171448199" }

journalctl /usr/sbin/sshd --no-pager -o json-pretty

{

"__CURSOR" : "s=1f967cdb38644934b6add6dca6147120;i=ab550;b=81a1ae5398824daea9b502bf3ddfc092;m=2488403b14;t=5c84eebbadaf5;x=3e575c4f570ffd13",
"__REALTIME_TIMESTAMP" : "1627616171449077",
"__MONOTONIC_TIMESTAMP" : "156904733460",
"_BOOT_ID" : "81a1ae5398824daea9b502bf3ddfc092",
"_TRANSPORT" : "syslog",
"_UID" : "0",
"_GID" : "0",
"_CAP_EFFECTIVE" : "3fffffffff",
"_MACHINE_ID" : "df9d1eef11ee45fd92b407191b390e56",
"_HOSTNAME" : "imx6qsabresd",
"PRIORITY" : "6",
"SYSLOG_FACILITY" : "4",
"SYSLOG_IDENTIFIER" : "sshd",
"_COMM" : "sshd",
"_EXE" : "/usr/sbin/sshd",
"_CMDLINE" : "sshd: root [priv]",
"_SYSTEMD_SLICE" : "system-sshd.slice",
"SYSLOG_PID" : "17696",
"MESSAGE" : "Accepted password for root from 192.168.5.44 port 65341 ssh2",
"_PID" : "17696",
"_SYSTEMD_CGROUP" : "/system.slice/system-sshd.slice/sshd@57-192.168.5.242:22-192.168.5.44:65341.service",
"_SYSTEMD_UNIT" : "sshd@57-192.168.5.242:22-192.168.5.44:65341.service",
"_SOURCE_REALTIME_TIMESTAMP" : "1627616171448199"

}

查看了一下帮助文件,支持的格式还不少。

 -o --output=STRING       Change journal output mode (short, short-iso,
                                    short-precise, short-monotonic, verbose,
                                    export, json, json-pretty, json-sse, cat)
                               

不知道json-sse是什么东西,试试。

journalctl /usr/sbin/sshd --no-pager -o json-sse

data: { "__CURSOR" : "s=1f967cdb38644934b6add6dca6147120;i=ab550;b=81a1ae5398824daea9b502bf3ddfc092;m=2488403b14;t=5c84eebbadaf5;x=3e575c4f570ffd13", "__REALTIME_TIMESTAMP" : "1627616171449077", "__MONOTONIC_TIMESTAMP" : "156904733460", "_BOOT_ID" : "81a1ae5398824daea9b502bf3ddfc092", "_TRANSPORT" : "syslog", "_UID" : "0", "_GID" : "0", "_CAP_EFFECTIVE" : "3fffffffff", "_MACHINE_ID" : "df9d1eef11ee45fd92b407191b390e56", "_HOSTNAME" : "imx6qsabresd", "PRIORITY" : "6", "SYSLOG_FACILITY" : "4", "SYSLOG_IDENTIFIER" : "sshd", "_COMM" : "sshd", "_EXE" : "/usr/sbin/sshd", "_CMDLINE" : "sshd: root [priv]", "_SYSTEMD_SLICE" : "system-sshd.slice", "SYSLOG_PID" : "17696", "MESSAGE" : "Accepted password for root from 192.168.5.44 port 65341 ssh2", "_PID" : "17696", "_SYSTEMD_CGROUP" : "/system.slice/system-sshd.slice/sshd@57-192.168.5.242:22-192.168.5.44:65341.service", "_SYSTEMD_UNIT" : "sshd@57-192.168.5.242:22-192.168.5.44:65341.service", "_SOURCE_REALTIME_TIMESTAMP" : "1627616171448199"}

linux socket 设置缓冲区大小时内核会翻倍
示例代码:

#include <sys/socket.h>
#include <stdio.h>

int main(int argc, char **argv)
{
 int sockfd, sendbuff;
 socklen_t optlen;

 sockfd = socket(AF_INET, SOCK_DGRAM, 0);
 if(sockfd == -1)
     printf("Error");

 int res = 0;

 // Get buffer size
 optlen = sizeof(sendbuff);
 res = getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &sendbuff, &optlen);

 if(res == -1)
     printf("Error getsockopt one");
 else
     printf("send buffer size = %d\n", sendbuff);

 // Set buffer size
 sendbuff = 98304;

 printf("sets the send buffer to %d\n", sendbuff);
 res = setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &sendbuff, sizeof(sendbuff));

 if(res == -1)
     printf("Error setsockopt");


 // Get buffer size
 optlen = sizeof(sendbuff);
 res = getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &sendbuff, &optlen);

 if(res == -1)
     printf("Error getsockopt two");
 else
     printf("send buffer size = %d\n", sendbuff);

 return 0;
}

运行结果:

send buffer size = 129024
sets the send buffer to 98304
new send buffer size = 196608

官方手册说明

SO_SNDBUFSets or gets the maximum socket send buffer in bytes. The ker-nel doubles this value (to allow space for bookkeeping overhead) when it is set using setsockopt(), and this doubled value is returned by getsockopt(). The default value is set by the wmem_default sysctl and the maximum allowed value is set by the wmem_max sysctl. The minimum (doubled) value for this option is 2048.

编译结果

./protoc --version

libprotoc 3.17.3

git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive
mkdir x64
cd x64
../configure --prefix=$(pwd)/install
make
make install

运行编译好的程序

./install/bin/protoc --version

libprotoc 3.17.3
查看所有库文件

tree install/lib/

install/lib/
├── libprotobuf.a
├── libprotobuf.la
├── libprotobuf-lite.a
├── libprotobuf-lite.la
├── libprotobuf-lite.so -> libprotobuf-lite.so.28.0.3
├── libprotobuf-lite.so.28 -> libprotobuf-lite.so.28.0.3
├── libprotobuf-lite.so.28.0.3
├── libprotobuf.so -> libprotobuf.so.28.0.3
├── libprotobuf.so.28 -> libprotobuf.so.28.0.3
├── libprotobuf.so.28.0.3
├── libprotoc.a
├── libprotoc.la
├── libprotoc.so -> libprotoc.so.28.0.3
├── libprotoc.so.28 -> libprotoc.so.28.0.3
├── libprotoc.so.28.0.3
└── pkgconfig

├── protobuf-lite.pc
└── protobuf.pc

编译arm版本protobuf库

cd ../
mkdir arm
cd arm/
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ../configure --prefix=$(pwd)/install --host=arm-linux
make -j8
make install
file ./install/bin/protoc 

./install/bin/protoc: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=cea786b94a0b64b866983c8b4541df34e9cc7c1d, with debug_info, not stripped

protobuf/arm$ tree ./install/lib/

./install/lib/
├── libprotobuf.a
├── libprotobuf.la
├── libprotobuf-lite.a
├── libprotobuf-lite.la
├── libprotobuf-lite.so -> libprotobuf-lite.so.28.0.3
├── libprotobuf-lite.so.28 -> libprotobuf-lite.so.28.0.3
├── libprotobuf-lite.so.28.0.3
├── libprotobuf.so -> libprotobuf.so.28.0.3
├── libprotobuf.so.28 -> libprotobuf.so.28.0.3
├── libprotobuf.so.28.0.3
├── libprotoc.a
├── libprotoc.la
├── libprotoc.so -> libprotoc.so.28.0.3
├── libprotoc.so.28 -> libprotoc.so.28.0.3
├── libprotoc.so.28.0.3
└── pkgconfig

├── protobuf-lite.pc
└── protobuf.pc

使用git 直接git clone github的库,不会报googletest 相关的警告,自动下载好了。如果自己在github.com protobuf release哪儿下载的放在,编译时候会报一个没有googletest的警告。好烦。。

configure: WARNING: no configuration information is in third_party/googletest

用户名ubuntu
最终命令

sudo usermod -aG www-data ubuntu

添加用户到组命令:sudo usermod -aG 组名 用户名

usermod -h
Usage: usermod [options] LOGIN

Options:
  -b, --badnames                allow bad names
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
  -a, --append                  append the user to the supplemental GROUPS
                                mentioned by the -G option without removing
                                the user from other groups
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the
                                new location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -R, --root CHROOT_DIR         directory to chroot into
  -P, --prefix PREFIX_DIR       prefix directory where are located the /etc/* files
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
  -v, --add-subuids FIRST-LAST  add range of subordinate uids
  -V, --del-subuids FIRST-LAST  remove range of subordinate uids
  -w, --add-subgids FIRST-LAST  add range of subordinate gids
  -W, --del-subgids FIRST-LAST  remove range of subordinate gids
  -Z, --selinux-user SEUSER     new SELinux user mapping for the user account

c/c++中使用mktime时,有时候会返回-1错误,主要的原因是输入了非法值,下面是一些常用的示例

#include <bits/stdc++.h>
#include <ctime>
#include <cstdio>
using namespace std;
//g++ mktime.cpp -std=c++11 -o mktime
int main(int argc, char* argv[])
{
    cout<<"mktime example"<<endl;
    struct tm stm;
    stm.tm_sec = 0;
    stm.tm_min = 0;
    stm.tm_hour = 0;
    stm.tm_mday = 1;
    stm.tm_mon = 0;
    stm.tm_year = 70;
    time_t ret;
    setenv("TZ","Etc/GMT",1);
    tzset();
    ret = mktime(&stm);
    printf("Etc/GMT ret = %ld\n", ret);
    setenv("TZ","Europe/Berlin",1);
    tzset();
    ret = mktime(&stm);
    printf("UTC+01:00 ret = %ld\n", ret);
    setenv("TZ","Atlantic/Azores",1);
    tzset();
    ret = mktime(&stm);
    printf("UTC-01:00 ret = %ld\n", ret);
    setenv("TZ","Asia/Shanghai",1);
    tzset();
    ret = mktime(&stm);
    printf("Asia/Shanghai ret = %ld\n", ret);
}

编译,运行,结果

g++ mktime.cpp -std=c++11 -o mktime
./mktime
mktime example
Etc/GMT ret = 0
UTC+01:00 ret = -3600
UTC-01:00 ret = 3600
Asia/Shanghai ret = -28800
(UTC-12:00) 国际日期变更线西Etc/GMT+12
(UTC-11:00) 协调世界时-11Etc/GMT+11
(UTC-10:00) 夏威夷Pacific/Honolulu
(UTC-09:00) 安克雷奇America/Anchorage
(UTC-08:00) 下加利福尼亚州America/Santa_Isabel
(UTC-08:00) 太平洋时间(美国和加拿大)America/Los_Angeles
(UTC-07:00) 奇瓦瓦,拉巴斯,马萨特兰America/Chihuahua
(UTC-07:00) 亚利桑那America/Phoenix
(UTC-07:00) 山地时间(美国和加拿大)America/Denver
(UTC-06:00) 中美洲America/Guatemala
(UTC-06:00) 中部时间(美国和加拿大)America/Chicago
(UTC-06:00) 萨斯喀彻温America/Regina
(UTC-06:00) 瓜达拉哈拉,墨西哥城,蒙特雷America/Mexico_City
(UTC-05:00) 波哥大,利马,基多America/Bogota
(UTC-05:00) 印地安那州(东部)America/Indiana/Indianapolis
(UTC-05:00) 东部时间(美国和加拿大)America/New_York
(UTC-04:30) 加拉加斯America/Caracas
(UTC-04:00) 大西洋时间(加拿大)America/Halifax
(UTC-04:00) 亚松森America/Asuncion
(UTC-04:00) 乔治敦,拉巴斯,马瑙斯,圣胡安America/La_Paz
(UTC-04:00) 库亚巴America/Cuiaba
(UTC-04:00) 圣地亚哥America/Santiago
(UTC-03:30) 纽芬兰America/St_Johns
(UTC-03:00) 巴西利亚America/Sao_Paulo
(UTC-03:00) 格陵兰America/Godthab
(UTC-03:00) 卡宴,福塔雷萨America/Cayenne
(UTC-03:00) 布宜诺斯艾利斯America/Argentina/Buenos_Aires
(UTC-03:00) 蒙得维的亚America/Montevideo
(UTC-02:00) 协调世界时-2Etc/GMT+2
(UTC-01:00) 佛得角群岛Atlantic/Cape_Verde
(UTC-01:00) 亚速尔群岛Atlantic/Azores
(UTC+00:00) 卡萨布兰卡Africa/Casablanca
(UTC+00:00) 蒙罗维亚,雷克雅未克Atlantic/Reykjavik
(UTC+00:00) 都柏林,爱丁堡,里斯本,伦敦Europe/London
(UTC+00:00) 协调世界时Etc/GMT
(UTC+01:00) 阿姆斯特丹,柏林,伯尔尼,罗马,斯德哥尔摩,维也纳Europe/Berlin
(UTC+01:00) 布鲁塞尔,哥本哈根,马德里,巴黎Europe/Paris
(UTC+01:00) 中非西部Africa/Lagos
(UTC+01:00) 贝尔格莱德,布拉迪斯拉发,布达佩斯,卢布尔雅那,布拉格Europe/Budapest
(UTC+01:00) 萨拉热窝,斯科普里,华沙,萨格勒布Europe/Warsaw
(UTC+01:00) 温得和克Africa/Windhoek
(UTC+02:00) 雅典,布加勒斯特,伊斯坦布尔Europe/Istanbul
(UTC+02:00) 赫尔辛基,基辅,里加,索非亚,塔林,维尔纽斯Europe/Kiev
(UTC+02:00) 开罗Africa/Cairo
(UTC+02:00) 大马士革Asia/Damascus
(UTC+02:00) 安曼Asia/Amman
(UTC+02:00) 哈拉雷,比勒陀利亚Africa/Johannesburg
(UTC+02:00) 耶路撒冷Asia/Jerusalem
(UTC+02:00) 贝鲁特Asia/Beirut
(UTC+03:00) 巴格达Asia/Baghdad
(UTC+03:00) 明斯克Europe/Minsk
(UTC+03:00) 利雅得Asia/Riyadh
(UTC+03:00) 内罗毕Africa/Nairobi
(UTC+03:30) 德黑兰Asia/Tehran
(UTC+04:00) 莫斯科,圣彼得堡,伏尔加格勒Europe/Moscow
(UTC+04:00) 第比利斯Asia/Tbilisi
(UTC+04:00) 埃里温Asia/Yerevan
(UTC+04:00) 阿布扎比,马斯喀特Asia/Dubai
(UTC+04:00) 巴库Asia/Baku
(UTC+04:00) 路易港Indian/Mauritius
(UTC+04:30) 喀布尔Asia/Kabul
(UTC+05:00) 塔什干Asia/Tashkent
(UTC+05:00) 伊斯兰堡,卡拉奇Asia/Karachi
(UTC+05:30) 斯里加亚渥登普拉Asia/Colombo
(UTC+05:30) 钦奈,加尔各答,孟买,新德里Asia/Kolkata
(UTC+05:45) 加德满都Asia/Kathmandu
(UTC+06:00) 阿斯塔纳Asia/Almaty
(UTC+06:00) 达卡Asia/Dhaka
(UTC+06:00) 叶卡捷琳堡Asia/Yekaterinburg
(UTC+06:30) 仰光Asia/Yangon
(UTC+07:00) 曼谷,河内,雅加达Asia/Bangkok
(UTC+07:00) 新西伯利亚Asia/Novosibirsk
(UTC+08:00) 克拉斯诺亚尔斯克Asia/Krasnoyarsk
(UTC+08:00) 乌兰巴托Asia/Ulaanbaatar
(UTC+08:00) 北京,重庆,香港,乌鲁木齐Asia/Shanghai
(UTC+08:00) 佩思Australia/Perth
(UTC+08:00) 吉隆坡,新加坡Asia/Singapore
(UTC+08:00) 台北Asia/Taipei
(UTC+09:00) 伊尔库茨克Asia/Irkutsk
(UTC+09:00) 首尔Asia/Seoul
(UTC+09:00) 大阪,札幌,东京Asia/Tokyo
(UTC+09:30) 达尔文Australia/Darwin
(UTC+09:30) 阿德莱德Australia/Adelaide
(UTC+10:00) 霍巴特Australia/Hobart
(UTC+10:00) 雅库茨克Asia/Yakutsk
(UTC+10:00) 布里斯班Australia/Brisbane
(UTC+10:00) 关岛,莫尔兹比港Pacific/Port_Moresby
(UTC+10:00) 堪培拉,墨尔本,悉尼Australia/Sydney
(UTC+11:00) 符拉迪沃斯托克Asia/Vladivostok
(UTC+11:00) 所罗门群岛,新喀里多尼亚Pacific/Guadalcanal
(UTC+12:00) 协调世界时+12Etc/GMT-12
(UTC+12:00) 斐济,马绍尔群岛Pacific/Fiji
(UTC+12:00) 马加丹Asia/Magadan
(UTC+12:00) 奥克兰,惠灵顿Pacific/Auckland
(UTC+13:00) 努库阿洛法Pacific/Tongatapu
(UTC+13:00) 萨摩亚群岛Pacific/Apia

Referenced from:https://jp.cybozu.help/general/zh/admin/list_systemadmin/list_localization/timezone.html

需要注意的是:
time():返回自00:00:00 UTC, January 1, 1970到現在所經過的秒數,注意,是UTC,中文默认时间是CST,也是UTC+08:00