LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 12-08-2023, 05:12 AM   #1
maddy0
Member
 
Registered: May 2023
Posts: 84

Rep: Reputation: 2
Setting time zone


Hi, I have a small problem: I can't set the right time.
I live in Italy, then, my timezone is Europe/Rome CET UTC+1.

tony:~\& date
Fri 08 Dec 2023 13:06:06 CET

tony:~\& ls -al /etc/localtime
lrwxrwxrwx 1 root root 33 Dec 8 12:51 /etc/localtime -> ../usr/share/zoneinfo/Europe/Rome

tony:~\& su
Password:
root@xxx:/home/tony# sudo ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime

Italy time is 12:11 PM, what's wrong ?
Tryed this way, but nothing has changed.
sudo dpkg-reconfigure tzdata

Current default time zone: 'Europe/Rome'
Local time is now: Fri Dec 8 14:21:57 CET 2023.
Universal Time is now: Fri Dec 8 13:21:57 UTC 2023.
Seems UTC+1 is NOT listed in Debian timezones?
timedatectl list-timezones
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2023-12-08_14-26-28.png
Views:	4
Size:	2.7 KB
ID:	42196   Click image for larger version

Name:	ksnip_20231208-145834.png
Views:	4
Size:	87.8 KB
ID:	42197  

Last edited by maddy0; 12-08-2023 at 06:59 AM.
 
Old 12-08-2023, 08:29 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,705

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
Regardless of timezone setting you still need to set the system clock to the correct time.
timedatectl set-time 15:58:30 (Use your current local time)
Post the output of the command timedatectl

When your PC boots the system clock is set using the time from the hardware clock. Since your hardware clock reference is LOCAL the time is converted to UTC before the system clock is set. Hardware clocks do tend to drift and if not correct your system clock will be off. If the only operating system is linux then it is best to set the the hardware clock to UTC. Since the hardware clock itself does not have a timezone setting the reference is configured in the /etc/adjtime file using either LOCAL or UTC.

To keep the time synchronized many use ntp which is an automatic service that runs and sets the system clock using the internet.

You may also need to replace the BIOS battery if your PC is so equipped depending on its age.
 
Old 12-08-2023, 09:44 AM   #3
maddy0
Member
 
Registered: May 2023
Posts: 84

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by michaelk View Post
Regardless of timezone setting you still need to set the system clock to the correct time.
timedatectl set-time 15:58:30 (Use your current local time)
Post the output of the command timedatectl

When your PC boots the system clock is set using the time from the hardware clock. Since your hardware clock reference is LOCAL the time is converted to UTC before the system clock is set. Hardware clocks do tend to drift and if not correct your system clock will be off. If the only operating system is linux then it is best to set the the hardware clock to UTC. Since the hardware clock itself does not have a timezone setting the reference is configured in the /etc/adjtime file using either LOCAL or UTC.

To keep the time synchronized many use ntp which is an automatic service that runs and sets the system clock using the internet.

You may also need to replace the BIOS battery if your PC is so equipped depending on its age.
Thank you for answering,i did these things:
timedatectl set-time with my local time and went good.
Then i rebooted system and setting up the correct time in BIOS, but when the system was rebooted the current time was wrong
My last try was:
sudo dpkg-reconfigure tzdata putting Porto (UTC+0) as timezone, but, again, nothing has changed!
My pc is about 3/yo i don't thing battery is low.
P.S. the file /etc/adjtime is set to UTC
cat /etc/adjtime
0.000000 1702051655 0.000000
1702051655
UTC
p.s2. i only have Linux installed in my 2 SSD and w11 installed in a Virtualbox.
 
Old 12-08-2023, 09:49 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,705

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
Quote:
Then i rebooted system and setting up the correct time in BIOS, but when the system was rebooted the current time was wrong
Wrong as in what were the actual values? Nothing changed as in the output of the date command or the output of the timedatectl command?

The correct time in BIOS should be set to current UTC time.
 
Old 12-08-2023, 09:54 AM   #5
maddy0
Member
 
Registered: May 2023
Posts: 84

Original Poster
Rep: Reputation: 2
date
Fri 08 Dec 2023 16:50:56 WET

timedatectl
Local time: Fri 2023-12-08 16:52:32 WET
Universal time: Fri 2023-12-08 16:52:32 UTC
RTC time: Fri 2023-12-08 16:52:32
Time zone: Europe/Lisbon (WET, +0000)
System clock synchronized: yes
NTP service: n/a
RTC in local TZ: no
Everything good, but PC time is: pic 1
editin clock in Lisbon went good: pic2
p.s. The only setting i can change in BIOS is data, but not a timezone.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2023-12-08_16-54-00.png
Views:	3
Size:	5.3 KB
ID:	42198   Click image for larger version

Name:	Screenshot_2023-12-08_16-58-08.png
Views:	2
Size:	35.7 KB
ID:	42199  

Last edited by maddy0; 12-08-2023 at 10:03 AM.
 
Old 12-08-2023, 10:03 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,705

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
What linux distribution and desktop are you running? The desktop clock can have its own timezone setting independent of the system setting.
 
Old 12-08-2023, 10:06 AM   #7
maddy0
Member
 
Registered: May 2023
Posts: 84

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by michaelk View Post
What linux distribution and desktop are you running? The desktop clock can have its own timezone setting independent of the system setting.
Debian bookworm and xfce desktop.
 
Old 12-08-2023, 10:22 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,705

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
I am not real familiar with xfce settings but try right clicking on the clock, select properties and there should be a timezone setting.
 
Old 12-08-2023, 10:28 AM   #9
maddy0
Member
 
Registered: May 2023
Posts: 84

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by michaelk View Post
I am not real familiar with xfce settings but try right clicking on the clock, select properties and there should be a timezone setting.
I did if i use as Timezone Europe/Rome remains +1, if i put Lisbon, then, mark the right time.
Do you suggest another desktop? I don't like Gnome and Cinnamon.
 
Old 12-08-2023, 10:58 AM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,705

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
I don't remember but there should be a setting or maybe just leave it blank where the desktop uses the system timezone setting versus its own.
 
Old 12-08-2023, 11:30 AM   #11
maddy0
Member
 
Registered: May 2023
Posts: 84

Original Poster
Rep: Reputation: 2
Yup, thanks for helping, have a nice day.
 
Old 12-08-2023, 02:20 PM   #12
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 688
Blog Entries: 1

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Looks like you are fine, another method is to set TZ. For example:

Code:
setenv TZ Europe/Rome

or if sh type

export TZ="Europe/Rome"
The values to use are probably under dir "/usr/share/zoneinfo"

this way you do not have to change the clock.

But the sad thing with these new Desktop Environments, setting TZ seemed to have morphed to the way Microsoft Window does things. You need to use a GUI application. In the past, you could set TZ to whatever timezone you happen to be in, not having to worry about the system clock is. You can just change it on the fly easilly and each user can have their own TZ.
 
Old 12-08-2023, 03:07 PM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,705

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
The desktop timezone setting is separate from the system timezone setting or an individual TZ variable setting. Many desktops have the option of adding "world" clocks. The system clock is still set by the usual methods. I am not sure it is a sad thing.
 
Old 12-09-2023, 02:37 AM   #14
maddy0
Member
 
Registered: May 2023
Posts: 84

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by jmccue View Post
Looks like you are fine, another method is to set TZ. For example:

Code:
setenv TZ Europe/Rome

or if sh type

export TZ="Europe/Rome"
The values to use are probably under dir "/usr/share/zoneinfo"

this way you do not have to change the clock.

But the sad thing with these new Desktop Environments, setting TZ seemed to have morphed to the way Microsoft Window does things. You need to use a GUI application. In the past, you could set TZ to whatever timezone you happen to be in, not having to worry about the system clock is. You can just change it on the fly easilly and each user can have their own TZ.
Hello, thanks for posting, these the results:
root@xxx:/home/tony# sudo setenv TZ Europe/Rome
sudo: setenv: command not found
root@xxx:/home/tony# export TZ="Europe/Rome"
root@xxxx:/home/tony# timedatectl | grep local
RTC in local TZ: no
root@Nxxx:/home/tony# timedatectl
Local time: Sat 2023-12-09 09:29:56 WET
Universal time: Sat 2023-12-09 09:29:56 UTC
RTC time: Sat 2023-12-09 09:29:56
Time zone: Europe/Lisbon (WET, +0000)
System clock synchronized: yes
NTP service: n/a
RTC in local TZ: no
I already tryed:
sudo dpkg-reconfigure tzdata ;(
 
Old 12-09-2023, 08:14 AM   #15
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 688
Blog Entries: 1

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by michaelk View Post
The desktop timezone setting is separate from the system timezone setting or an individual TZ variable setting. Many desktops have the option of adding "world" clocks. The system clock is still set by the usual methods. I am not sure it is a sad thing.
Yes you are correct, and that is my point by saying this:

Quote:
... setting TZ seemed to have morphed to the way Microsoft Window does things
In the old days™, setting TZ was an easy thing, you never had to worry what the hardware clock was set as. Just add TZ to ~/.xsessions and/or ~/.xinitrc maybe ~/.profile and you are good.

Now with the way Linux works, you need to run a M/S Windows type time adjustment
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with zone-info in time zone data section Chapter-6.9 Glibc-2.24 koustubh Linux From Scratch 2 07-08-2020 04:38 PM
I find file zone in the slave zone to the do a transfer of zone from Windows Server 2012 as master dns and CentOS as slave DNS. To learn Linux - Newbie 1 09-02-2016 09:36 AM
Which zone bind dns work either in forward zone are reverse zone sanjay87 Linux - Server 2 06-05-2012 04:21 AM
Run script in EST time zone but server is in GMT zone jeesun Linux - Networking 1 04-04-2010 01:37 PM
Setting System Time: kernel in wrong time zone warrenweiss Linux - General 7 05-15-2004 03:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 07:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration