How To Use Etc Localtime
For this example assume that your current timezone is utc as shown below.
How to use etc localtime. 1 root root 34 feb 16 03 07 etc localtime usr share zoneinfo asia kolkata use the following command to check the current timezone on systemd system. The timezone information is universally kept under etc localtime. The c library function struct tm localtime const time t timer uses the time pointed by timer to fill a tm structure with the values that represent the corresponding local time. You would like to change this to pacific. Change timezone on a centos 6 and 7.
1 root root 25 jul 11 16 06 etc localtime usr share zoneinfo utc root kerneltalks ls lrt usr share zoneinfo total 284 rw r r. Let us see some examples to change timezone or set a new time zone on a centos linux. Cd etc localtime is a symbolic link so we can remove it rm localtime all timezones are located under. Ls l etc localtime lrwxrwxrwx. Root kerneltalks ll etc localtime lrwxrwxrwx.
To dual boot with windows it is recommended to configure windows to use utc rather than linux to use localtime. Windows by default uses localtime. Use one of the following methods to change the timezone on your linux system. Etc localtime is the file used by the kernel to determine the timezone. Following is the declaration for localtime function.
Check the current timezone using etc localtime file. Struct tm localtime const time t timer. Etc localtime it is a symlink to the file localtime or to the correct timezone file in the system located in usr share zoneinfo directory. 1 log on to the linux server and switch user to root execute the date command to find the current time date and time zone of the linux server. It can be done by a simple registry fix.
Change timezone using etc localtime file. Assume we have timezone utc. 2 cat etc localtime will give the current time zone of the server. Open regedit and add a dword value for 32 bit windows or qword for 64 bit one with hexadecimal value 1 to the registry. On more modern systems this file is merely a symbolic link to text based timezone files stored under usr share zoneinfo region city.