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() ...
随机推荐
- Jquery实现选项卡功能
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Surfer 高并发双核无头浏览器 (Golang语言)
Surfer A high level concurrency downloader. surfer是一款Go语言编写的高并发爬虫下载器,拥有surf与phantom两种下载内核. 支持固定Use ...
- C#委托和事件详解
委托Delegate delegate是C#中的一种类型,它实际上是一个能够持有对某个方法的引用的类.与其它的类不同,delegate类能够拥有一个签名(signature),并且它"只能持 ...
- VC++实现编辑框输入提示效果
编辑框在第一次输入时最好给出一个虚拟的输入提示信息文本,这样的效果更佳友好.,我在编辑框添加灰色提示字(html+VC)一文中简单介绍了一些方法,但是效果欠佳. 原始的编辑框CEdit类没有这样的功能 ...
- Storm-源码分析-Streaming Grouping (backtype.storm.daemon.executor)
executor在发送outbounding message的时候, 需要决定发送到next component的哪些tasks 这里就需要用到streaming grouping, 1. mk- ...
- android 开发者资源下载地址记录(转+补充)
https如果无法下载的话将下面的:https://dl-ssl 部分改为 http://dl (1)Android SDK (Android SDK主安装包,包含SDK Manager.AVD Ma ...
- mybatis由浅入深day01_4.9删除用户_4.10更新用户
4.9 删除用户 4.9.1 映射文件 4.9.2 代码: 控制台: 4.10 更新用户 4.10.1 映射文件 4.10.2 代码 控制台:
- 分布式消息队列RocketMQ与Kafka架构上的巨大差异之1 -- 为什么RocketMQ要去除ZK依赖?
我们知道,在早期的RocketMQ版本中,是有依赖ZK的.而现在的版本中,是去掉了对ZK的依赖,转而使用自己开发的NameSrv. 并且这个NameSrv是无状态的,你可以随意的部署多台,其代码也非常 ...
- python2.0 s12 day8 _ 堡垒机前戏paramiko模块
堡垒机前戏 开发堡垒机之前,先来学习Python的paramiko模块,该模块机遇SSH用于连接远程服务器并执行相关操作 paramiko模块是做主机管理的,他模拟了一个ssh. 有两种形式连接形式, ...
- Linux 下安装 Python3
Linux CentOS 7 安装 Python3: [root@localhost ~]$ yum install -y epel-release [root@localhost ~]$ yum i ...