I have Centos server, in which I don't want to jump back the time to one hour during time change. instead I want to slow down the system clock few hour before the time change so that when the time jumps back, my server should sync with latest time after time change
As said in the comments, switching on DST won't change your machine time at all, only the timezone. Therefore you don't need to mess with the server clock (and you're advised not to).
On a side note, there's a project that does something similar to what you want. Google uses it to "smear" the extra second over a longer time whenever the IERS enforces a leap second. Basically, during a whole day, Google server clocks run a bit slower so that when the leap second is applied at midnight the servers experience no time jump. Again, I add this just FYI -- this is not a solution for your case.
I think there's a timezone confusion here.
The expected way to keep time on a Unix/Linux system is to have the BIOS clock and the kernel system clock running on UTC. You then have one (or more) time zones for your users. The time zone conversion ensures that the underlying UTC clock is displayed in the user's local time.
Let's try to give an example:
# UTC date/time as known by the system clock date -u Tue 31 Jan 14:06:23 UTC 2017 # Local time in the UK TZ=Europe/London date Tue 31 Jan 14:06:25 GMT 2017 # Local time in France TZ=Europe/Paris date Tue 31 Jan 15:06:27 CET 2017 # Local time in west coast USA TZ=US/Pacific date Tue 31 Jan 06:06:30 PST 2017
Here's another one:
# UTC absolute reference TZ=UTC ls -l whos_pointing.txt -rw-r--r-- 1 roaima roaima 143 Jan 31 14:08 whos_pointing.txt # Local time in the UK TZ=Europe/London ls -l whos_pointing.txt -rw-r--r-- 1 roaima roaima 143 Jan 31 14:08 whos_pointing.txt # Local time in France TZ=Europe/Paris ls -l whos_pointing.txt -rw-r--r-- 1 roaima roaima 143 Jan 31 15:08 whos_pointing.txt # Local time in west coast USA TZ=US/Pacific ls -l whos_pointing.txt -rw-r--r-- 1 roaima roaima 143 Jan 31 06:08 whos_pointing.txt
The file is the same file, but its date/time is displayed differently depending on where the system thinks I am at any point.
# Back in the USA export TZ=US/Pacific ls -l whos_pointing.txt -rw-r--r-- 1 roaima roaima 143 Jan 31 06:08 whos_pointing.txt touch whos_pointing.txt ls -l whos_pointing.txt -rw-r--r-- 1 roaima roaima 143 Jan 31 06:16 whos_pointing.txt # Jump across to the UK. Notice the file's timestamp has updated here too export TZ=Europe/London ls -l whos_pointing.txt -rw-r--r-- 1 roaima roaima 143 Jan 31 14:16 whos_pointing.txt
It's not difficult to set up a system-wide default timezone, nor is it difficult for particular users to override that with the
TZ environment variable. I have a server in California where the default timezone is
US/Pacific but my own login account contains
The timezone conversion libraries automatically handle the jump between summer and winter time in the timezones where they are applied. The system clock does not jump, but the hourly (or half-hourly) offset is modified at the appropriate instant. Database systems use the system's absolute time internally, so they are unaffected by apparent jumps forwards or backwards in the users' displayed time. NTP also works with system absolute time, which is how it can handle servers in different timezones around the world (it doesn't need to worry!).