FAKE-HWCLOCK(8)

πŸ’– fake-hwclock(8) β€” the "my computer has no clock so we're faking it" page πŸ’–

okay bestie, sit down, because this one is a lifesaver and it lives in section 8 of the System Manager's Manual. it's called fake-hwclock and it's literally "Control fake hardware clock". yes. fake. we're faking it. and we're eating.


✨ NAME ✨

fake-hwclock β€” Control fake hardware clock πŸ•°οΈβœ¨

🫢 SYNOPSIS 🫢

fake-hwclock [ command ] [ force ]

like... that's it. that's the whole vibe. a command, maybe a force, we move on πŸ’…

🌸 BACKGROUND 🌸

so here's the tea 🍡. many embedded Linux systems do not have a functional hardware clock. like, at all. either:

  • they simply don't have a hardware clock, periodt πŸ’€
  • or they do have one but it's not usable β€” e.g. because Linux doesn't know how to use it, or because there's no battery in it πŸ”‹βŒ

and the consequence? this is the bad part, bestie. time can move backwards to some default value (often 1970 😭) when the system is rebooted. and because lots of software just assumes that time only moves forward, this is a bad thing. like, main-character-level bad.

NTP can (and should, where practical) be used to sync with an external timeserver 🌐 β€” but here's the thing: it is not available early in the boot process, and it may be unavailable for other reasons too. so NTP is not enough on its own. rude of it, honestly.

so what's the design expectation of fake-hwclock? it gets run very late at shutdown and very early at boot. that way fsck has a vaguely sensible idea of system time at boot and won't be out here complaining that the last-modified time in the filesystem is not hugely in the past or future πŸ™ˆ. fsck is so dramatic.

some users may not worry about this use case β€” in which case it is possible to modify the init system configuration to move things earlier/later as appropriate. customize your timeline, queen πŸ‘‘

πŸ’… DESCRIPTION πŸ’…

fake-hwclock sets and queries a fake "hardware clock" which stores the time in a file. the clock isn't real but the file is. we improvise. we adapt. we slay.

this program may be run by the system administrator directly, but it is typically run by:

  • init β€” to load the time on startup and save it on shutdown πŸ”
  • cron β€” to save the time hourly ⏰

and here's the fun lil default: if no command is given then fake-hwclock acts as if the save command was used. no notes. it just does it. iconic behaviour honestly.

πŸŽ€ COMMANDS πŸŽ€

  • save β€” Save the time to the file πŸ’Ύ. but the way it's got a sanity check: fake-hwclock will not move the saved clock backwards to a time/date earlier than its own release date. so no time-travelling before this program even existed, bestie, we have standards. use force to over-ride this check 😀
  • load β€” Load the time from the file πŸ“–. if force is specified, fake-hwclock will move the clock either backwards or forwards. otherwise it will only move it forwards. forward only, no looking back, that's the energy ✨

🌈 FILES 🌈

  • /etc/fake-hwclock.data β€” the file used to store the time πŸ—„οΈ
  • /etc/init.d/fake-hwclock β€” the init script used to run fake-hwclock on startup and shutdown πŸ”„
  • /usr/lib/systemd/system/fake-hwclock-load.service β€” systemd service used to run fake-hwclock on startup πŸŒ…
  • /usr/lib/systemd/system/fake-hwclock-save.service β€” systemd service used to run fake-hwclock on shutdown πŸŒ™
  • /usr/lib/systemd/system/fake-hwclock-save.timer β€” systemd timer used to save the time hourly ⏳
  • /etc/default/fake-hwclock β€” settings file for the init script βš™οΈ
  • /etc/cron.hourly/fake-hwclock β€” cron job used to save the time hourly πŸ“

πŸ¦‹ ENVIRONMENT VARIABLES πŸ¦‹

  • FILE β€” set the file used by fake-hwclock πŸ“

⭐ RETURN VALUES ⭐

  • 1 is returned for invalid commands 🚫
  • 0 is returned in all other cases βœ…

πŸ’€ BUGS πŸ’€

not me having to be honest with you: this approach can only provide a crude approximation of what a real hardware clock provides. it's fake, bb, that was the whole premise.

use of NTP or another method to keep the time in sync is strongly advised. like, strongly. take the advice. 🫢


okay that's the whole page, you're basically a clock expert now πŸ•°οΈπŸ‘‘

this has been Debian, dated 12 July 2026 β€” sending you love, sensible timestamps, and absolutely no 1970 energy. mwah πŸ’–βœ¨

πŸ“¦ where this page comes from