[Linuxptp-devel] [PATCH] Fix uninitialized variable in nmea_scan_rmc

2021-04-20 Thread Lars Munch
tm_isdst needs to be initialized to make sure mktime does not fail or calculates the wrong time. Signed-off-by: Lars Munch --- nmea.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nmea.c b/nmea.c index dc865d0..44c7c01 100644 --- a/nmea.c +++ b/nmea.c @@ -157,6 +157,7 @@ static int

Re: [Linuxptp-devel] [PATCH] Fix uninitialized variable in nmea_scan_rmc

2021-04-20 Thread Lars Munch
printf("%ld\n", mktime(&t)); t.tm_isdst = 0; printf("%ld\n", mktime(&t)); t.tm_isdst = -1; printf("%ld\n", mktime(&t)); } 1618941220 1618941220 1618941220 So my problem might come from the fact that I do not have any timezone database on my system.

Re: [Linuxptp-devel] [PATCH] Fix uninitialized variable in nmea_scan_rmc

2021-04-20 Thread Lars Munch
; > t.tm_isdst = -1; > printf("%ld\n", mktime(&t)); > } > Yields: > 1618928503 > 1618932103 > 1618932103 > This is true on FreeBSD 13 and Ubuntu 18.04, both fully patched. > > -michael > > On Tue, Apr 20, 2021 at 7:04 AM Richard Cochran > wrot

Re: [Linuxptp-devel] [PATCH] Fix uninitialized variable in nmea_scan_rmc

2021-04-20 Thread Lars Munch
t.tm_isdst = 1; printf("%ld\n", mktime(&t)); t.tm_isdst = 0; printf("%ld\n", mktime(&t)); t.tm_isdst = -1; printf("%ld\n", mktime(&t)); } Gives: -1 1618956512 1618956512 This is on my up-to-date Arch Linux and Ubuntu 20.04. On my Ubunt

Re: [Linuxptp-devel] [PATCH] Fix uninitialized variable in nmea_scan_rmc

2021-04-21 Thread Lars Munch
bug report in the > relevant packages/systems. > > > > Erez > > > > > > *From:* Lars Munch > *Sent:* Tuesday, 20 April 2021 22:24 > *To:* Michael Galassi > *Cc:* linuxptp-devel@lists.sourceforge.net > *Subject:* Re: [Linuxptp-devel] [PATCH] Fix uninitializ

Re: [Linuxptp-devel] [PATCH] Fix uninitialized variable in nmea_scan_rmc

2021-04-21 Thread Lars Munch
Cochran > Sent: Tuesday, 20 April 2021 16:05 > To: Lars Munch > Cc: linuxptp-devel@lists.sourceforge.net > Subject: Re: [Linuxptp-devel] [PATCH] Fix uninitialized variable in > nmea_scan_rmc > > On Tue, Apr 20, 2021 at 11:44:06AM +0200, Lars Munch wrote: > > tm_isdst needs t

Re: [Linuxptp-devel] [PATCH] Fix uninitialized variable in nmea_scan_rmc

2021-04-21 Thread Lars Munch
My tests show (with recent glibc version) that with TZ=UTC mktime will return -1 for tm_isdst=1. For tm_isdst=0 and tm_isdst=-1 mktime returns the same value. IMHO, tm_isdst=0 makes the most sense for TZ=UTC as UTC does not support DST. On Wed, Apr 21, 2021 at 6:50 PM Richard Cochran wrote: >

[Linuxptp-devel] [PATCH] Set domainNumber for telecom examples

2021-04-21 Thread Lars Munch
Set the default domain numbers according to the ITU-T standards Signed-off-by: Lars Munch --- configs/G.8265.1.cfg | 1 + configs/G.8275.1.cfg | 1 + configs/G.8275.2.cfg | 1 + 3 files changed, 3 insertions(+) diff --git a/configs/G.8265.1.cfg b/configs/G.8265.1.cfg index 11947b0..49eef04

[Linuxptp-devel] gpsd support in ts2phc

2021-05-08 Thread Lars Munch
Hi I have been using ts2phc directly to my GPS using serial connection to get NMEA sentences. This is working fine but then I cannot get status from the GPS while ts2phc is running. Therefore I have been pondering on how to add gpsd support to ts2phc. There are several options, maybe more: 1. Us

Re: [Linuxptp-devel] gpsd support in ts2phc

2021-05-13 Thread Lars Munch
On Sat, May 8, 2021 at 8:47 PM Richard Cochran wrote: > > On Sat, May 08, 2021 at 02:57:30PM +0200, Lars Munch wrote: > > > 1. Use the time provided by gpsd to ntpshm. This can be implemented without > > dependencies to gpsd. > > Doesn't sound aweful, but not g

[Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-05-14 Thread Lars Munch
tm_isdst needs to be initialized to make sure mktime does not fail on recent versions of glibc See: https://bugzilla.redhat.com/show_bug.cgi?id=1653340 https://sourceware.org/bugzilla/show_bug.cgi?id=24630 Signed-off-by: Lars Munch --- nmea.c | 1 + 1 file changed, 1 insertion(+) diff --git a

[Linuxptp-devel] [PATCH 3/4] ts2phc: Update leapfile documentation

2021-05-14 Thread Lars Munch
Update leapfile documentation to note the file will be reloaded if modified. Signed-off-by: Lars Munch --- ts2phc.8 | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ts2phc.8 b/ts2phc.8 index 0bd523d..99067c5 100644 --- a/ts2phc.8 +++ b/ts2phc.8 @@ -117,12 +117,12

[Linuxptp-devel] [PATCH 2/4] ts2phc: Close socket on peer shutdown

2021-05-14 Thread Lars Munch
Read returns 0 (the traditional "end-of-file" return) when a remote peer performs an orderly shutdown. Hence, ts2phc needs to close the socket and try to establish a new connection. Signed-off-by: Lars Munch --- ts2phc_nmea_master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletio

[Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-05-14 Thread Lars Munch
Add serial baudrate configuration option. Default to 9600 bps. Signed-off-by: Lars Munch --- config.c | 1 + ts2phc.8 | 23 --- ts2phc_nmea_master.c | 10 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/config.c b/config.c

Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-05-14 Thread Lars Munch
On Fri, May 14, 2021 at 4:45 PM Geva, Erez wrote: > > A great idea to add baud-rate. > > Just a suggestion, > As I remember from gtkterm application. > > It provide setting: port name, Baud rate, parity, bits, stop bit, and flow > control. > > What do you think of adding all of the setting? I di

Re: [Linuxptp-devel] [PATCH 2/4] ts2phc: Close socket on peer shutdown

2021-05-14 Thread Lars Munch
On Fri, May 14, 2021 at 4:24 PM Geva, Erez wrote: > > Make sense to handle 0, end of file. > But as it is NOT an error, perhaps it should use a proper pr_info(). So something like this? cnt = read(pfd.fd, input, sizeof(input)); if (cnt <= 0) { if (cnt == 0) pr_info("disconnected from

Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-05-14 Thread Lars Munch
standards > (ISO C or POSIX). > > I do not see the purpose of links to bugs in glibc. > > It is also does not helps the Developers to understand, why do we need the > patch (which we do need). > > > > We are a source project, not a binary one > > > > Erez

Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-05-14 Thread Lars Munch
t measure bugs by code. Measure by complexity. > > Erez > > -Original Message----- > From: Lars Munch > Sent: Friday, 14 May 2021 18:14 > To: Geva, Erez (ext) (DI PA DCP R&D 3) > Cc: linuxptp-devel@lists.sourceforge.net > Subject: Re: [Linuxptp-devel] [PATCH

Re: [Linuxptp-devel] gpsd support in ts2phc

2021-05-14 Thread Lars Munch
On Fri, May 14, 2021 at 7:33 PM Richard Cochran wrote: > > On Thu, May 13, 2021 at 07:31:27PM +0200, Lars Munch wrote: > > On Sat, May 8, 2021 at 8:47 PM Richard Cochran > > wrote: > > > > > > On Sat, May 08, 2021 at 02:57:30PM +0200, Lars Munch wrote: >

Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-05-14 Thread Lars Munch
are software engineers, not poets. Do not be hard on yourself. > > Just use something short, clear that describe the problem and the fix. > A message that if you read it in 2 years from now, you understand what was it. > > Erez > > -Original Message- > From: Lars Munch &g

Re: [Linuxptp-devel] [PATCH 3/4] ts2phc: Update leapfile documentation

2021-05-14 Thread Lars Munch
No, ts2phc does. That is the man page updated. On Fri, May 14, 2021 at 8:52 PM Keller, Jacob E wrote: > > > > > -Original Message- > > From: Lars Munch > > Sent: Friday, May 14, 2021 4:34 AM > > To: linuxptp-devel@lists.sourceforge.net > > Subje

Re: [Linuxptp-devel] [PATCH 2/4] ts2phc: Close socket on peer shutdown

2021-05-15 Thread Lars Munch
: > > Yes. > > -Original Message----- > From: Lars Munch > Sent: Friday, 14 May 2021 18:20 > To: Geva, Erez (ext) (DI PA DCP R&D 3) > Cc: linuxptp-devel@lists.sourceforge.net > Subject: Re: [Linuxptp-devel] [PATCH 2/4] ts2phc: Close socket on peer > shutdown > &

Re: [Linuxptp-devel] [PATCH 2/4] ts2phc: Close socket on peer shutdown

2021-05-15 Thread Lars Munch
I, of course, meant to write nmea source and not master. On Sat, May 15, 2021 at 11:14 PM Lars Munch wrote: > > On second thought I am not sure this should be a pr_info. Losing connection > to the master is not good even if it shuts down properly. Not being able to > connect to t