timedatectl — Control the system time and date
Ubuntu下运行:
timedatectl set-local-rtc 1 --adjust-system-clock
或者Windows下运行:
Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1
参考如下:
timedatectl --help 的执行结果如下:
timedatectl [OPTIONS...] COMMAND ... Query or change system time and date settings. -h --help Show this help message
--version Show package version
--no-pager Do not pipe output into a pager
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--adjust-system-clock Adjust system clock when changing local RTC mode Commands:
status Show current time settings
set-time TIME Set system time
set-timezone ZONE Set system time zone
list-timezones Show known time zones
set-local-rtc BOOL Control whether RTC is in local time
set-ntp BOOL Enable or disable network time synchronization
更详细的参数解释:
能够识别的命令行选项如下: --no-ask-password
在执行特权操作时 不向用户索要密码。 --adjust-system-clock
当使用 set-local-rtc 命令时, 若使用了此选项, 则表示根据RTC时间来更新系统时钟。 若未使用此选项, 则表示根据系统时钟来更新RTC时间。 --monitor
与 timesync-status 命令一起使用, 表示监视 systemd-timesyncd.service() 的状态并不断刷新输出。可以使用 Ctrl+C 终止监视。 -a, --all
显示全部的 systemd-timesyncd.service() 属性,无论这些属性是否已设置。 -p, --property=
仅显示指定的 systemd-timesyncd.service() 属性。若未指定任何属性则显示全部已设置的属性。 参数必须是一个例如 "ServerName" 这样的属性名称。 可以多次使用此选项,以显示多个属性。 --value
当使用 show-timesync 命令显示属性时, 仅显示属性的值(不显示"="与属性名称)。 -H, --host=
操作指定的远程主机。可以仅指定一个主机名(hostname), 也可以使用 "username@hostname" 格式。 hostname 后面还可以加上 SSH监听端口(以冒号":"分隔)与容器名(以正斜线"/"分隔), 也就是形如 "hostname:port/container" 的格式, 以表示直接连接到指定主机的指定容器内。 操作将通过SSH协议进行,以确保安全。 可以通过 machinectl -H HOST 命令列出远程主机上的所有容器名称。IPv6地址必须放在方括号([])内。 -M, --machine=
在本地容器内执行操作。 必须明确指定容器的名称。 -h, --help
显示简短的帮助信息并退出。 --version
显示简短的版本信息并退出。 --no-pager
不将程序的输出内容管道(pipe)给分页程序。
参考:http://www.jinbuguo.com/systemd/timedatectl.html
The following options are understood: --no-ask-password
Do not query the user for authentication for privileged operations. --adjust-system-clock
If set-local-rtc is invoked and this option is passed, the system clock is
synchronized from the RTC again, taking the new setting into account. Otherwise, the
RTC is synchronized from the system clock. -H, --host=
Execute the operation remotely. Specify a hostname, or a username and hostname
separated by "@", to connect to. The hostname may optionally be suffixed by a
container name, separated by ":", which connects directly to a specific container on
the specified host. This will use SSH to talk to the remote machine manager instance.
Container names may be enumerated with machinectl -H HOST. -M, --machine=
Execute operation on a local container. Specify a container name to connect to. -h, --help
Print a short help text and exit. --version
Print a short version string and exit. --no-pager
Do not pipe output into a pager. The following commands are understood: status
Show current settings of the system clock and RTC, including whether network time
synchronization is on. Note that whether network time synchronization is on simply
reflects whether the systemd-timesyncd.service unit is enabled. Even if this command
shows the status as off, a different service might still synchronize the clock with
the network. set-time [TIME]
Set the system clock to the specified time. This will also update the RTC time
accordingly. The time may be specified in the format "2012-10-30 18:17:16". set-timezone [TIMEZONE]
Set the system time zone to the specified value. Available timezones can be listed
with list-timezones. If the RTC is configured to be in the local time, this will also
update the RTC time. This call will alter the /etc/localtime symlink. See localtime(5)
for more information. list-timezones
List available time zones, one per line. Entries from the list can be set as the
system timezone with set-timezone. set-local-rtc [BOOL]
Takes a boolean argument. If "0", the system is configured to maintain the RTC in
universal time. If "1", it will maintain the RTC in local time instead. Note that
maintaining the RTC in the local timezone is not fully supported and will create
various problems with time zone changes and daylight saving adjustments. If at all
possible, keep the RTC in UTC mode. Note that invoking this will also synchronize the
RTC from the system clock, unless --adjust-system-clock is passed (see above). This
command will change the 3rd line of /etc/adjtime, as documented in hwclock(8). set-ntp [BOOL]
Takes a boolean argument. Controls whether network time synchronization is active and
enabled (if available). This enables and starts, or disables and stops the
systemd-timesyncd.service unit. It does not affect the state of any other, unrelated
network time synchronization services that might be installed on the system. This
command is hence mostly equivalent to: systemctl enable --now
systemd-timesyncd.service and systemctl disable --now systemd-timesyncd.service, but
is protected by a different access policy. Note that even if time synchronization is turned off with this command, another
unrelated system service might still synchronize the clock with the network. Also note
that, strictly speaking, systemd-timesyncd.service does more than just network time
synchronization, as it ensures a monotonic clock on systems without RTC even if no
network is available. See systemd-timesyncd.service(8) for details about this.
timedatectl — Control the system time and date的更多相关文章
- 工具类System,Runtime,Math,Date,Calendar
API--- java.lang.System: 属性和行为都是静态的. long currentTimeMillis(); // 返回当前时间毫秒值 exit(); // 退出虚拟机 Prop ...
- 处理时间的类 —— System类、Date类 、SimpleDateFormat类 与 Calendar类
在我们以往的编程中,就有过通过运行前和运行后时间差来判断时间复杂度的例子,再扯得远一点,我们在C语言中制造随机数的操作,也要用到有关时间的函数.而且,在我们未来的编程中,也会时不时要用到能够读取当前时 ...
- linux commands
abrt-cli --since ;查看abrt捕捉的异常 alias ;别名,alias rm='rm -i':使用“ \rm ” 使用原命令 alsamixer ;图形音量调节,q 增加左声道, ...
- 疯狂java笔记(五) - 系统交互、System、Runtime、Date类
一.程序与用户交互(Java的入口方法-main方法): 运行Java程序时,都必须提供一个main方法入口:public static void main(String[] args){} publ ...
- JAVA常用API(Date、DateFormat、Calendar、System、Math、基本数据类型包装类)
注:本文所有内容均属个人见解,如有错误望各位大佬好心指点批评,不胜感激 本章重点单词: parse:解析 format:格式化 pattern:模式 amount:数量 filed :领域 1.Dat ...
- JAVA之旅(二十三)——System,RunTime,Date,Calendar,Math的数学运算
JAVA之旅(二十三)--System,RunTime,Date,Calendar,Math的数学运算 map实在是太难写了,整理得我都晕都转向了,以后看来需要开一个专题来讲这个了,现在我们来时来学习 ...
- 08 正则表达式,Math类,Random,System类,BigInteger,BigDecimal,Date,DateFormat,Calendar
正则表达式: 是指一个用来描述或者匹配一系列符合某个语法规则的字符串的单个字符串.其实就是一种规则.有自己特殊的应用. public class Demo2_Regex { public sta ...
- Math、Random、System、BigInteger、Date、DateFormat、Calendar类,正则表达式_DAY14
1:Math&大数据类四则运算 X abs(X x) double random() 产生随机数 double ceil(double a) 向上取整 double flo ...
- day05(Object,tostring(),equals(),System,Date,SimpleDateFormat,拆装箱,正则表达式)
Object类, 是所应类的父类: 拥有自己的方法:常用的 红颜色标记的为常用的方法 toString() 用法:打印对象的地址值 getClass() 获取当前类的字节码文件getName() ...
随机推荐
- Storm On YARN带来的优点
1)弹性计算资源 将storm执行在yarn上后,Storm能够与其它计算框架(如mapreduce)共享整个集群的资源.这样当Storm负载骤增时,可动态为它添加计算资源. 负载减小时,能够 ...
- CentOS 6.5 下利用命令行截图及设置快捷键截图
CentOS 6.5 下利用命令行截图及设置快捷键截图 1.利用命令模式 捕获整个屏幕 : $ gnome-screenshot 截完屏之后我们可以设置自定义图片存储位置,如图: 捕获当前终端Term ...
- Linux配置防火墙,开启80port、3306port 可能会遇到的小问题
vi /etc/sysconfig/iptables -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT(同意80端口通 ...
- Shell 文本处理工具
转载自:http://www.cnblogs.com/wish123/p/5540210.html Linux下使用Shell处理文本时最常用的工具: find.grep.xargs.sort.uni ...
- tiny6410移植opencv
1.错误1, 解决办法:取消一下两个选项: 2.错误2, 解决办法: 原因是找不到pthread链接库,打开文件夹下的CmakeCache.txt进行修改 3.错误3, 解决办法:
- ScrollView:ScrollView can host only one direct child异常
java.lang.IllegalStateException: ScrollView can host only one direct child 原因是在外面有一个TextView控件,将其删除则 ...
- Windows版Nginx启动失败之1113: No mapping for the Unicode character exists in the target multi-byte code page
Windows版Nginx启动一闪,进程中未发现nginx进程,查看nginx日志,提示错误为1113: No mapping for the Unicode character exists in ...
- SDWebImage使用,图片加载和缓存
本文转载至 http://blog.163.com/wzi_xiang/blog/static/659829612012111402812726/ 清除缓存: [[SDImageCache s ...
- 安装安全狗后,MP4无法播放
- poj_3283 trie树
题目大意 将一副牌进行编号,四种花色分别标记为'C'.'D'.'H'.'S',数值标记为'A'.'1'.'2'.'3'.'4'.'5'.'6'.'7'.'8'.'9'.'10'.'J'.'Q'.'K' ...