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() ...
随机推荐
- Eclipse最经常使用快捷键总结
1. ctrl+shift+r:打开资源 这可能是全部快捷键组合中最省时间的了. 这组快捷键能够让你打开你的工作区中不论什么一个文件,而你仅仅须要按下文件名称或mask名中的前几个字母,比方appl ...
- Mysql经常使用基本命令汇总及默认账户权限与改动
一直仅仅是在浅显利用数据库存储数据.也被windows惯坏了.非常多命令使用的时候记不起来.so,换LINUX系统!不再使用GUI管理数据库!也想深入学习下Mysql.从权限管理開始.也就诞生了这篇学 ...
- 【Java集合的详细研究7】Set和List 的关系与区别
两个接口都是继承自Collection. List (inteface) 次序是List 的最重要特点,它确保维护元素特定的顺序. --ArrayList 允许对元素快速随机访问. --LinkedL ...
- informatica 中的workflow连接mysql数据配置DSN
先要下载mysqlodbc 一步步安装之后 ,再从管理工具里面找到ODBC,最后选择系统DSN,添加mysql驱动之后,进入添加编辑: 在workflow里面的配置连接字符串就写刚刚配置的连接名称 比 ...
- VCL 中的 Windows API 函数(6): BeginDeferWindowPos
BeginDeferWindowPos 和 DeferWindowPos.EndDeferWindowPos 是一组一起使用的函数, 可对一组窗口的位置.大小.Z 序等进行调整, 在 ExtCtrls ...
- ASP.NET MVC自定义验证Authorize Attribute(包含cookie helper)
前几天Insus.NET有在数据库实现过对某一字段进行加密码与解密<使用EncryptByPassPhrase和DecryptByPassPhrase对MS SQLServer某一字段时行加密和 ...
- 【matlab】图像去噪的代码测试
%% 自己设置频域的滤波窗口 girl=imread('F:\Users\*****\Pictures\CGS_stripe1.bmp'); girl=rgb2gray(girl); girl=im2 ...
- 彩色图像的直方图均衡化matlab代码
彩色图像的直方图均衡化 - YangYudong2014的专栏 - CSDN博客 http://blog.csdn.net/yangyudong2014/article/details/4051503 ...
- 静默安装oracle 11g,环境预检查时报错,SEVERE: [FATAL] PRVF-0002 : 无法检索本地节点名
环境描述: 操作系统:Redhat 6.6_x64 oracle:11.2.0.4 x64 问题描述: 今天在安装oracle 11g的数据库,在进行预安装环境检查的时候,报下面的错误: [oracl ...
- 2.1 C语言下的位运算
位运算符: 注:运算量仅仅能为整型和字符型数据,不能是实数型的数据. 当进行&运算时:0&1=0.1&0=0:1&1=1:0&0=0: 当进行|运算时:0|1= ...