Setting the clock of your system is of prime importance to PC (computer) users all over. This is usually necessary for those Linux users running in a text-based command line interface. Most times a regular internet convention can make this a bliss, as Linux automatically updates its date and time (clock) online especially when it is configured to do so. But for other reasons available where your Linux box is losing track of time, would be somehow disastrous. For instance, a Linux user using a standalone PC or workstations at home, the importance of an accurate time might be trivialized and little or no attention is given to it. But such cannot be the attitude in a large networked environment (e.g Corporate office networks, cyber cafes, etc.) because backups, scheduled downtimes and other network-wide actions need to be accurately coordinated.
The Linux operating system provides its own time and date , while the computer hardware provides a hardware clock-based time. In many scenarios, it is possible for the two times to drift apart. The Linux system time is based on the number of seconds elapsed since January 1, 1970. The hardware (computer) time depends on the type of clock chips installed on your PC’s motherboard. So a little tweaking would be needed for bringing both “clocks” back on track.
For those that prefer using the graphical configuration tools available on their various Linux distributions. It is just a matter of following intuitively, the clickable buttons and instructions that would also accompany it. But for the rest, like me, would prefer to get their hands dirty with typing commands on the Shell, the following is for you. So let’s get our hands dirty with some few Linux commands.
Using the date command:
To see the current date of your system use;
Assuming the date displayed is not correct, to adjust to whenever you want use the command like this;
# date 061909002011
In the command above, we used the date command to set the system date to June (06), 19, 2011 at 9 A.M (0900).
Using the hwclock command:
The hwclock command can be used to display and set your PC’s hardware clock, and also synchronize the system and hardware times.
#hwclock – -show
To set the date and time together;
#hwclock –set –date “19/06/11 09:00:00”
To set the system time from the hardware clock, use the – – hctosys option;
To set the hardware clock using the system time use the –systohc option;