How To Use Etc Localtime

2 cat etc localtime will give the current time zone of the server.
How to use etc localtime. The value of timer is broken up into the structure tm and expressed in the local time zone. Date mon feb 18 18 40 10 ist 2019. Ls l etc localtime lrwxrwxrwx. 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. 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.
On more modern systems this file is merely a symbolic link to text based timezone files stored under usr share zoneinfo region city. 1 root root 35 jan 16 22 10 etc localtime usr share zoneinfo europe oslo. The timezone information is universally kept under etc localtime. Following is the declaration for localtime function. If you check your current file its a soft link to respective timezone file in usr share zoneinfo directory.
Cd etc localtime is a symbolic link so we can remove it rm localtime all timezones are located under. If the tz env variable is not set glibc will go look at the etc localtime file every time or rather it will check if etc localtime has changed since the last time it was read which is what the stat calls does nos sep 24 14 at 15 38. Etc localtime is the file used by the kernel to determine the timezone. Use one of the following methods to change the timezone on your linux system. Root oradbfw hq01 mgmt date mon sep 11 09 29 27 utc 2017 on many distributions like oel centos.
Let us see some examples to change timezone or set a new time zone on a centos linux. 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. It can be done by a simple registry fix. For this example assume that your current timezone is utc as shown below. You would like to change this to pacific.
Change timezone using etc localtime file. The timezone is conntrolled by localtime file located in etc directory. Assume we have timezone utc. Open regedit and add a dword value for 32 bit windows or qword for 64 bit one with hexadecimal value 1 to the registry. Ls lh etc localtime lrwxrwxrwx.