I will just take your comment suggestion. I do not want to spend more
time on this.

On Fri, May 14, 2021 at 7:50 PM Geva, Erez <erez.geva....@siemens.com> wrote:
>
> I think you can mention you are talking on UTC (Every one know UTC).
>
> May be something like:
> "As UTC do not use daylight savings time and with accords to POSIX, disable 
> the use of daylight savings by setting tm_isdst to 0".
>
> Feel free to find a better syntax.
>
> Or just copy the 2 lines from the POSIX (2004 Edition)
> https://pubs.opengroup.org/onlinepubs/009695399/functions/mktime.html
> "A positive or 0 value for tm_isdst shall cause mktime() to presume initially 
> that Daylight Savings Time, respectively, is or is not in effect for the 
> specified time.
>  A negative value for tm_isdst shall cause mktime() to attempt to determine 
> whether Daylight Savings Time is in effect for the specified time."
>
> Are you sure it was added in POSIX 2017?
> I do not think you need to be that precise which version of POSIX you use, 
> they usually do not change much. Only enhance functionality or improve 
> description.
>
> Last thought:
> We 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 <l...@segv.dk>
> Sent: Friday, 14 May 2021 19:30
> To: Geva, Erez (ext) (DI PA DCP R&D 3) <erez.geva....@siemens.com>
> Cc: linuxptp-devel@lists.sourceforge.net
> Subject: Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable 
> in nmea_scan_rmc
>
> So how about the following simple explanation?
>
> According to POSIX.1-2017 tm_isdst must be set to 0 to indicate that Daylight 
> Savings Time is not in effect for the specified time.
>
>
>
> On Fri, May 14, 2021 at 6:28 PM Geva, Erez <erez.geva....@siemens.com> wrote:
> >
> > One of my hardest bug was one a single bit.
> > Do not measure bugs by code. Measure by complexity.
> >
> > Erez
> >
> > -----Original Message-----
> > From: Lars Munch <l...@segv.dk>
> > Sent: Friday, 14 May 2021 18:14
> > To: Geva, Erez (ext) (DI PA DCP R&D 3) <erez.geva....@siemens.com>
> > Cc: linuxptp-devel@lists.sourceforge.net
> > Subject: Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized
> > variable in nmea_scan_rmc
> >
> > So much work for a one-liner. I see If I can come up with a better 
> > explanation.
> >
> > On Fri, May 14, 2021 at 4:34 PM Geva, Erez <erez.geva....@siemens.com> 
> > wrote:
> > >
> > > Hi,
> > >
> > >
> > >
> > > I think it is better to use a short explanation how does mktime() use the 
> > > tm_isdst flag, and why should it be set to 0.
> > >
> > > For me the problem is that we did not comply with proper use of mktime().
> > >
> > > Fixing glibc only revealed the bug in linuxptp.
> > >
> > > So we fix linuxptp, not trying to comply with a specific glibc!
> > >
> > >
> > >
> > > The choice of libc is up to the user, as long as it comply to the 
> > > 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
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Lars Munch <l...@segv.dk>
> > > Sent: Friday, 14 May 2021 13:34
> > > To: linuxptp-devel@lists.sourceforge.net
> > > Subject: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized
> > > variable in nmea_scan_rmc
> > >
> > >
> > >
> > > tm_isdst needs to be initialized to make sure mktime does not fail
> > > on recent versions of glibc
> > >
> > >
> > >
> > > See:
> > >
> > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbu
> > > gzilla.redhat.com%2Fshow_bug.cgi%3Fid%3D1653340&amp;data=04%7C01%7Ce
> > > rez.geva.ext%40siemens.com%7C9d2a2f4353c0403194bc08d916fdfdd6%7C38ae
> > > 3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566103157490221%7CUnknown%
> > > 7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC
> > > JXVCI6Mn0%3D%7C3000&amp;sdata=BkgCRqVecfkCb4ug8zYUpNz%2By6Lum%2FIm4y
> > > ZiZj8Hsw4%3D&amp;reserved=0
> > >
> > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fso
> > > urceware.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D24630&amp;data=04%7C01
> > > %7Cerez.geva.ext%40siemens.com%7C9d2a2f4353c0403194bc08d916fdfdd6%7C
> > > 38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566103157500214%7CUnkn
> > > own%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haW
> > > wiLCJXVCI6Mn0%3D%7C3000&amp;sdata=%2FFscYQHQqnvekRr%2Fkmf2H4FL96HsT2
> > > EbDqEF%2F2f1qHw%3D&amp;reserved=0
> > >
> > >
> > >
> > > Signed-off-by: Lars Munch <l...@segv.dk>
> > >
> > > ---
> > >
> > > 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 nmea_scan_rmc(struct nmea_parser *np,
> > > struct nmea_rmc *result)
> > >
> > >                }
> > >
> > >                tm.tm_year += 100;
> > >
> > >                tm.tm_mon--;
> > >
> > > +             tm.tm_isdst = 0;
> > >
> > >                result->ts.tv_sec = mktime(&tm);
> > >
> > >                result->ts.tv_nsec = msec * 1000000UL;
> > >
> > >                result->fix_valid = status == 'A' ? true : false;
> > >
> > > --
> > >
> > > 2.25.1
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > >
> > > Linuxptp-devel mailing list
> > >
> > > Linuxptp-devel@lists.sourceforge.net
> > >
> > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fli
> > > sts.sourceforge.net%2Flists%2Flistinfo%2Flinuxptp-devel&amp;data=04%
> > > 7C01%7Cerez.geva.ext%40siemens.com%7C9d2a2f4353c0403194bc08d916fdfdd
> > > 6%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566103157500214%7C
> > > Unknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik
> > > 1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=%2FVBUVBAwqnX4zjGxzwRCxGsLRIWc
> > > xP2lUuVN%2B%2FYtwGI%3D&amp;reserved=0


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to