WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: time changes  (Read 4214 times)

Offline jls

  • Hero Member
  • *****
  • Posts: 2135
time changes
« on: August 05, 2019, 06:17:42 AM »
Hi
After some minutes the time changes.
I set it but it doesn't keep.
Thanks
dCore user

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: time changes
« Reply #1 on: August 05, 2019, 03:10:53 PM »
Give the output of the the command:

Code: [Select]
date

both before and after the change. And the command used to set it.  Do you have any scripts that set or alter the time on startup?  I use ntpdate in a script to set my time to the internet time service on boot.  The time changes when the script is run, which can interfere with certain running programs but it normally runs before I reach the desktop.

Offline jls

  • Hero Member
  • *****
  • Posts: 2135
Re: time changes
« Reply #2 on: August 06, 2019, 03:28:40 AM »
Hello Jason,
Code: [Select]
jls@box:~$ date
mar  6 ago 2019, 08.57.56, CEST
jls@box:~$
I have the following command in /opt/bootlocal.sh:
Code: [Select]
( sleep 20 && ntpdate -u ntp1.inrim.it && etc/init.d/ntp start) &
infact when the system is started:
Code: [Select]
jls@box:~$ ps|grep ntpd
ntp      10849     1  0 08:14 ?        00:00:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 101:101
jls      12607 12187  0 08:21 pts/0    00:00:00 grep ntpd
jls@box:~$
Bios time is wrong but if I change it to correct time then it keep going out of time.
Thanks for any help
dCore user

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: time changes
« Reply #3 on: August 06, 2019, 11:19:08 AM »
Here is the script I use to set my time, and then set the hardware bios clock.  This way the bios clock can be wrong on startup, then made right with the below commands.  After the script is run and the time is set, my system time does not change on it's own after that.

Code: [Select]
#!/bin/sh

sudo ntpdate -s time.nist.gov

sudo hwclock -w



Offline jls

  • Hero Member
  • *****
  • Posts: 2135
Re: time changes
« Reply #4 on: August 08, 2019, 12:56:34 AM »
Hi

Code: [Select]
jls@box:~$ ps|grep ntpd
ntp      11169     1  0 06:00 ?        00:00:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 101:101
jls      16823 15536  0 06:56 pts/1    00:00:00 grep ntpd
jls@box:~$ sudo hwclock --show && date
2019-08-08 09:37:58.771268+0200
gio  8 ago 2019, 06.39.04, CEST
jls@box:~$ pgrep ntpd
11169
jls@box:~$ sudo hwclock --show && date
2019-08-08 09:43:24.195429+0200
gio  8 ago 2019, 09.43.25, CEST
jls@box:~$ sudo hwclock --show && date
2019-08-08 09:53:53.036795+0200
gio  8 ago 2019, 06.54.59, CEST
jls@box:~$

dCore user