macOS Sonoma 14.5 系统时间不对


=Start=

缘由:

如题,今天不知道什么时候出现的这个情况(搞得我都有点时间错乱了)。按照网上的一些方法操作了也不行,最后是通过命令解决的,在此记录一下,方便后面有需要的时候参考。

正文:

参考解答:

通过命令看看日期时间信息:

$ date
2024年 5月16日 星期四 18时33分21秒 +0630

实际北京时间是:
2024年 5月16日 星期四 20时03分

差了1个半小时。能明显看出来是时区错了(北京是+0800,现在是+0630)

但是通过:

系统设置 – 通用 – 日期与时间 进去手动打开/关闭【自动设定日期与时间】功能也不行。来源是默认的(Apple (time.apple.com.))

最后是通过 systemsetup 命令处理好的:

$ sudo systemsetup -listtimezones | grep -i shanghai
$
$ sudo systemsetup -settimezone Asia/Shanghai
2024-05-16 18:46:07.261 systemsetup[2765:50595] ### Error:-99 File:/AppleInternal/Library/BuildRoots/91a344b1-f985-11ee-b563-fe8bc7981bff/Library/Caches/com.apple.xbs/Sources/Admin/InternetServices.m Line:379
Set TimeZone: Asia/Shanghai
$
$ sudo systemsetup -gettimezone
Time Zone: Asia/Shanghai
$
$ man systemsetup
...
systemsetup – configuration tool for certain machine settings in System Preferences.
systemsetup - 在系统偏好设置中用于某些机器设置的配置工具。
...
$
$ sudo systemsetup -printCommands
systemsetup -getdate
systemsetup -setdate <mm:dd:yy>
systemsetup -gettime
systemsetup -settime <hh:mm:ss>
systemsetup -gettimezone
systemsetup -settimezone <timezone>
systemsetup -listtimezones
systemsetup -getusingnetworktime
systemsetup -setusingnetworktime <on off>
systemsetup -getnetworktimeserver
systemsetup -setnetworktimeserver <timeserver>
systemsetup -getsleep
systemsetup -setsleep <minutes>
systemsetup -getcomputersleep
systemsetup -setcomputersleep <minutes>
systemsetup -getdisplaysleep
systemsetup -setdisplaysleep <minutes>
systemsetup -getharddisksleep
systemsetup -setharddisksleep <minutes>
systemsetup -getwakeonmodem
systemsetup -setwakeonmodem <on off>
systemsetup -getwakeonnetworkaccess
systemsetup -setwakeonnetworkaccess <on off>
systemsetup -getrestartpowerfailure
systemsetup -setrestartpowerfailure <on off>
systemsetup -getrestartfreeze
systemsetup -setrestartfreeze <on off>
systemsetup -getallowpowerbuttontosleepcomputer
systemsetup -setallowpowerbuttontosleepcomputer <on off>
systemsetup -getremotelogin
systemsetup -setremotelogin <on off>
systemsetup -getremoteappleevents
systemsetup -setremoteappleevents <on off>
systemsetup -getcomputername
systemsetup -setcomputername <computername>
systemsetup -getlocalsubnetname
systemsetup -setlocalsubnetname <name>
systemsetup -getstartupdisk
systemsetup -setstartupdisk <disk>
systemsetup -liststartupdisks
systemsetup -getwaitforstartupafterpowerfailure
systemsetup -setwaitforstartupafterpowerfailure <seconds>
systemsetup -getdisablekeyboardwhenenclosurelockisengaged
systemsetup -setdisablekeyboardwhenenclosurelockisengaged <yes no>
systemsetup -version
systemsetup -help
systemsetup -printCommands

一、NTP 是什么?

NTP 是网络时间协议(Network Time Protocol),它用来同步网络设备【如计算机、手机】的时间的协议。

二、NTP 实现什么目的?

目的很简单,就是为了提供准确时间。因为我们的手表、手机、电脑等设备,经常会跑着跑着时间就出现了误差,或快或慢的少几秒,时间长了甚至误差过分钟。

三、NTP 服务器列表

Windows系统上自带的两个: time.windows.com 和 time.nist.gov

MacOS上自带的两个: time.apple.com 和 time.asia.apple.com

NTP授时快速域名服务: cn.ntp.org.cn

中国科学院国家授时中心: ntp.ntsc.ac.cn

开源NTP服务器: cn.pool.ntp.org

1、阿里云授时服务器
ntp.aliyun.com

2、腾讯云授时服务器
time1.cloud.tencent.com
time2.cloud.tencent.com
time3.cloud.tencent.com
time4.cloud.tencent.com
time5.cloud.tencent.com

3、国内大学授时服务器
ntp.tuna.tsinghua.edu.cn 清华大学(ipv4/ipv6)

3、国外授时服务器

苹果提供的授时服务器

time1.apple.com
time2.apple.com
time3.apple.com
time4.apple.com
time5.apple.com
time6.apple.com
time7.apple.com

Google提供的授时服务器

time1.google.com
time2.google.com
time3.google.com
time4.google.com

参考链接:

No option to change time zone [duplicate] #实测有用
https://apple.stackexchange.com/questions/457075/no-option-to-change-time-zone

Macbook incorrectly sets date time based on my location
https://apple.stackexchange.com/questions/451143/macbook-incorrectly-sets-date-time-based-on-my-location

How to Change Your Time Zone on Mac?
https://testingbot.com/software-testing-questions/how-to-change-your-time-zone-on-mac

如果无法在 Apple 设备上更改时间或时区
https://support.apple.com/zh-cn/101619

国内常用NTP服务器地址
https://www.jianshu.com/p/28864ab7fdd9

=END=


发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注