×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

[ indi_gpsd ] Time is not pulled from gpsd?

  • Posts: 43
  • Thank you received: 4
I have not setup ntpd yet. So my system time is not synchronized.
The UTC time in indi client seems to be system time, but not gpsd time.
Is it a bug?
4 years 10 months ago #39431
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 28
Why not just write a python script which populates GPS time after boot. Then when you start kstars, the time is correct.
4 years 10 months ago #39483

Please Log in or Create an account to join the conversation.

  • Posts: 1309
  • Thank you received: 226
gpstime.py
A Python script I use for force the system clock to update.
import os
import sys
import time
from gps import *
 
print 'Attempting to access GPS time...'
 
try:
	gpsd = gps(mode=WATCH_ENABLE)
except:
	print 'No GPS connection present. TIME NOT SET.'
	sys.exit()
 
while True:
	gpsd.next()
	if gpsd.utc != None and gpsd.utc != '':
		gpstime = gpsd.utc[0:4] + gpsd.utc[5:7] + gpsd.utc[8:10] + ' ' + gpsd.utc[11:19]
		print 'Setting system time to GPS time...'
		os.system('sudo date -u --set="%s"' % gpstime)
		print 'System time set.'
		sys.exit()
	time.sleep(1)
4 years 10 months ago #39532

Please Log in or Create an account to join the conversation.

  • Posts: 43
  • Thank you received: 4
Hi, this is not about 'How to get datetime from gpsd'.
This is to concern which time should be displayed on the panel of indi_gpsd.
Does this work as design or be a bug?
And which time will kstars use?
The system time is shown on the panel will make confusion.
4 years 10 months ago #39548

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 28
As ihoujin and i have said, a simple script will also do the job. I don't know if it is a bug, that is a question for the developers.

I had similar issues as you and fixed it with the script.

Check out this thread

www.indilib.org/forum/general/2730-how-t...ver-work-for-me.html

it may help.
4 years 10 months ago #39609

Please Log in or Create an account to join the conversation.

  • Posts: 1309
  • Thank you received: 226

It looks to me like you need to complete the configuration of NTPD to use the GPS time, then the driver should sync up.
Last edit: 4 years 10 months ago by Andrew.
4 years 10 months ago #39625

Please Log in or Create an account to join the conversation.

  • Posts: 43
  • Thank you received: 4
As @IHOUJIN described, it very easy to get the GPS time. So why the indi_gpsd does not get it?
To run the ntpd/chrony will cause a problem under indi.
The gpsd is default to run as plug&play mode, that mean it will scan all the serial ports (ttyUSB0 and other ttyXXX). And to setup chrony to sync datetime needs "-n" option of gpsd, which makes gpsd to lock all the serial ports all the time.
So the mount model will report "the device is used by other program" on /dev/ttyUSB0
To fix it we need to turn the plug&play off (USBAUTO=false) and input the device name for gpsd, /dev/ttyACM0 for example.
This is so boring.
BTW, I didn't find any info like above in the document. I wonder if there is anyone really has tried USB gps device with indi.

People need to write a script / or to change many settings to make the gps work for indi. Is it the true design of this function?
Why not get and update the datetime by inde_gpsd?
The following user(s) said Thank You: Alfred
Last edit: 4 years 9 months ago by ecloud.
4 years 9 months ago #40677

Please Log in or Create an account to join the conversation.

I actually just checked the code for the indi-gpsd and was surprised to find that it uses system time... in there a comment that assumes gpsd is synched with ntpd or chronyd but I don't think a driver should make this assumption. I will make it use the GPS actual time and maybe add a switch to toggle this behavior so that the existing use case would be perserved via config switch.
The following user(s) said Thank You: Alfred, Keld Henningsen
4 years 9 months ago #40702

Please Log in or Create an account to join the conversation.

Ok fix pushed.
The following user(s) said Thank You: Alfred, Andrew
4 years 9 months ago #40704

Please Log in or Create an account to join the conversation.

Time to create page: 0.631 seconds