How to synchronize the time indicated by xfce4 with the time reported by the system (that's the correct one)

Hello.

How can I synchronize the time indicated by xfce4 with the time reported by the system (that's the correct one) ? The image attached below is self-explanatory. I tried to update the timezone using different keywords,but none of them has been accepted. Very thanks.

Screenshot_2022-12-30_19-06-17.jpg
 
Use the same timezone (localtime) aka remove the timezone that you entered.

Timezone
Allows you to set a custom timezone for the clock by entering the name of a file in the zoneinfo database. If left blank, the clock uses the localtime.
 
it is always empty,but sometime,as you can see on the attached picture,the time indicated by xfce stops to be the time indicated by the system (this is the correct one). Anyway it fixed by itself. I don't know why it goes out of syncro.
 
It doesn't fixed by itself. When you type non existing timezone the xfce4 clock show the time in UTC. When you leave it empty it show your localtime already set in FreeBSD.
If you type your correct timezone (Europe/Rome) you will see that the clock will be the same as if you leave the field empty.
 
nope. I can't write my current timezone on the input field because as I've said before,every character I put on the field,it is not accepted.
 
It did it again. In Italy now it is 18:48,but xfce4 clock shows 17:49 and there is no way (that I know) to update it.
 
sudo cp -p /usr/share/zoneinfo/Europe/Rome /etc/localtime. You may have to restart xfce4. The date command uses the value of the TZ env. variable if set. If not set, it uses /etc/localtime. I noticed in the included picture the time zone name in the xfce4 time zone field is wrong. It should be Europe/Rome, not Europe/Italy/Rome since it is really a file path relative to /usr/share/zoneinfo.
 
In the xfce4 time zone field I have also tried to insert "Europe/Rome",but it didn't work as well.
 
Now in the directory called /etc I have a file called "localtime". This file was previously called "Rome". Is this correct ?
 
Happy New year 2023 to you,too !

Code:
# ls -l /etc/localtime
-r--r--r--  1 root  wheel  2666 Dec 28 17:07 /etc/localtime

maybe the command suggested by bakul is wrong !

Code:
sudo cp -p /usr/share/zoneinfo/Europe/Rome /etc/localtime
 
See FILES and BUGS tzsetup().
adjkerntz should be run only if you are dual booting windows (that prefers the cmos time to be localtime). But this has nothing to do with /etc/localtime. Unless you *expect* your local timezone to change (very very unlikely) cp is better as then date etc show correct time even before /usr is mounted (usually nowadays /usr is usually not a separate filesystem so it doesn’t matter whether you use cp or on -s)
 
Back
Top