You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kali Linux 2018.1时钟异常求助:date -u与hwclock -u结果不一致

Fixing the 1-Hour Clock Drift on Kali Linux 2018.1

Hey, let's work through this clock issue you're facing. The key clue here is that hwclock -u gives the correct time—this tells me your hardware clock (RTC) is properly set to UTC, but something's off with how your system is interpreting or syncing that time. Let's break down the fixes step by step:

1. Check Your Timezone Configuration

First, make sure your system is using the right timezone. Run this to see your current setup:

timedatectl

Look for the Time zone line—if you're in a region like China, it should say Asia/Shanghai (CST, +0800). If it's wrong (like showing UTC or another mismatched timezone), set it correctly with:

sudo timedatectl set-timezone Asia/Shanghai

(Replace Asia/Shanghai with your actual timezone, e.g., Europe/London if you're in the UK.)

2. Ensure Hardware Clock Uses UTC Mode

Linux expects the hardware clock to store UTC time, then converts it to local time based on your timezone. If your system is treating the RTC as local time, that'll cause the 1-hour mismatch. Check with:

timedatectl | grep "RTC in local TZ"

If the output says yes, fix it by switching to UTC mode:

sudo timedatectl set-local-rtc 0

3. Sync System Clock to the Correct Hardware Clock

Now we'll force the system clock to match the correct UTC time from your hardware clock:

sudo hwclock --hctosys --utc

This command takes the time from the hardware clock (HC) and sets the system clock (SYS) to match, using UTC as the reference.

To prevent this issue from coming back, turn on NTP to keep your clock automatically synced with reliable time servers:

sudo timedatectl set-ntp on

Verify it's working by checking:

timedatectl | grep "NTP synchronized"

You should see yes if it's active and syncing properly.

Test the Fix

Reboot your system, then run these commands to confirm everything's working as expected:

  • date: Should show your correct local time
  • date -u: Should match the output of hwclock -u (both are UTC time)
  • hwclock: Should show your local time (since it converts the UTC hardware clock to your configured timezone)

内容的提问来源于stack exchange,提问作者Engo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:00:19