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的更多相关文章

  1. 工具类System,Runtime,Math,Date,Calendar

    API--- java.lang.System: 属性和行为都是静态的. long currentTimeMillis(); // 返回当前时间毫秒值   exit();  // 退出虚拟机 Prop ...

  2. 处理时间的类 —— System类、Date类 、SimpleDateFormat类 与 Calendar类

    在我们以往的编程中,就有过通过运行前和运行后时间差来判断时间复杂度的例子,再扯得远一点,我们在C语言中制造随机数的操作,也要用到有关时间的函数.而且,在我们未来的编程中,也会时不时要用到能够读取当前时 ...

  3. linux commands

    abrt-cli --since ;查看abrt捕捉的异常 alias ;别名,alias rm='rm -i':使用“ \rm ” 使用原命令 alsamixer ;图形音量调节,q 增加左声道, ...

  4. 疯狂java笔记(五) - 系统交互、System、Runtime、Date类

    一.程序与用户交互(Java的入口方法-main方法): 运行Java程序时,都必须提供一个main方法入口:public static void main(String[] args){} publ ...

  5. JAVA常用API(Date、DateFormat、Calendar、System、Math、基本数据类型包装类)

    注:本文所有内容均属个人见解,如有错误望各位大佬好心指点批评,不胜感激 本章重点单词: parse:解析 format:格式化 pattern:模式 amount:数量 filed :领域 1.Dat ...

  6. JAVA之旅(二十三)——System,RunTime,Date,Calendar,Math的数学运算

    JAVA之旅(二十三)--System,RunTime,Date,Calendar,Math的数学运算 map实在是太难写了,整理得我都晕都转向了,以后看来需要开一个专题来讲这个了,现在我们来时来学习 ...

  7. 08 正则表达式,Math类,Random,System类,BigInteger,BigDecimal,Date,DateFormat,Calendar

    正则表达式:    是指一个用来描述或者匹配一系列符合某个语法规则的字符串的单个字符串.其实就是一种规则.有自己特殊的应用. public class Demo2_Regex { public sta ...

  8. Math、Random、System、BigInteger、Date、DateFormat、Calendar类,正则表达式_DAY14

    1:Math&大数据类四则运算 X abs(X x) double random()         产生随机数 double ceil(double a)   向上取整 double flo ...

  9. day05(Object,tostring(),equals(),System,Date,SimpleDateFormat,拆装箱,正则表达式)

    Object类, 是所应类的父类: 拥有自己的方法:常用的    红颜色标记的为常用的方法 toString() 用法:打印对象的地址值 getClass() 获取当前类的字节码文件getName() ...

随机推荐

  1. 【Java集合的详细研究5】Java中Array与ArrayList的主要区别

    1)精辟阐述:可以将 ArrayList想象成一种“会自动扩增容量的Array”. 2)Array([]):最高效:但是其容量固定且无法动态改变:     ArrayList:  容量可动态增长:但牺 ...

  2. PHP必备知识:如何下载样式文件中的图片

    <?php header("content-type:text/html;charset=utf-8"); set_time_limit(0); $styleImg = fi ...

  3. c++ c++ 与 Java

    1.c++ c++ 如果1个类的定义中包含另一个类,那么在stdafx.h中 被包含的类必须放在包含类的前面,不然编译器找不到被包含类,c++没有包的概念,所以包含头文件时要注意顺序,而java不存在 ...

  4. mongodb php auto increment 自增

    mongodb的自增实现根oracle,postgresql是差不多,都是通过计数器来实现的. oracle自增实现: 实例说明oracle序列用法 postgresql自增实现: postgresq ...

  5. 第三章 Spring.Net 环境准备和搭建

    在前面一章我们介绍了依赖注入,控制反转的概念.接下来我们来真正动手搭建一下Spring.Net的环境,看一下Spring.Net 中的控制反转和依赖注入是什么样子. 3.1  Spring.Net 下 ...

  6. 九度 1547 出入栈(递推DP)

    题目描述: 给定一个初始为空的栈,和n个操作组成的操作序列,每个操作只可能是出栈或者入栈.要求在操作序列的执行过程中不会出现非法的操作,即不会在空栈时执行出栈操作,同时保证当操作序列完成后,栈恰好为一 ...

  7. openstack将本地实例迁移至ceph存储中

    需求: 最近在openstack上线了ceph存储,创建虚拟机和云硬盘都基于ceph卷进行存储和创建,但是之前openstack用的是本地存储,创建的所有实例都在本地文件中,当实例重启之后,opens ...

  8. UVa 10905 - Children's Game(求多个正整数排列后,所得的新的数字的极值)

    4thIIUCInter-University Programming Contest, 2005 A Children’s Game Input: standard input Output: st ...

  9. MQTT的学习研究(五) MQTT moquette 的 Blocking API 发布消息服务端使用

    参看官方文档: http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.amqtat.doc/t ...

  10. Dockerfile分享之SSH Server

    版权声明:本文由姚俊刚原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/84 来源:腾云阁 https://www.qclou ...