For some reason, I want to configure the date/time in my Linux (CentOS 6.5) to be different from the REAL date/time, but the setting won't work if I turn my computer(desktop not laptop if this matters, AND this computer has no access to the Internet) on after a sudden power cut, the date/time will be the old date/time before the configuration, I unplug the power adapter manually to simulate the sudden power cut situation.

How to make the configuration still work after turning on the computer even a sudden power cut happens?

I ONLY care about the date/time setting problem here, no worries about the data loss or something like this after sudden power cut, so besides the UPS solution, are there other better solution? If I can just make some configuration inside the Linux, that would be the answer I'm asking for.

  • Are you just using date or are you already persisting it to the BIOS with hwclock --systohc? Jul 24, 2015 at 4:27
  • I only use date to show the date/time, and set the date/time in the system-settings application or using settimeofday in a program, both settings are not working once a sudden power cut happens. Should I use hwclock --systohc?
    – CodyChan
    Jul 24, 2015 at 4:32
  • Trying hwclock --systohc is unlikely to make the problem worse. (You may run into things like your time zone offset being added to the system time on each boot if you set local time and thesystem expects UTC and things like that, but you can see if the year, month, day and minute persist over a reboot now and fix the other stuff later.) Jul 24, 2015 at 6:20


You must log in to answer this question.

Browse other questions tagged .