My Arch system does indeed have daylight saving set, but nmea.c forces the
TZ to UTC where a positive value of tm_isdst does not make sense.

On Wed, Apr 21, 2021 at 1:51 PM Geva, Erez <erez.geva....@siemens.com>
wrote:

> Looks like the man page is not accurate.
> Looking in
> 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.
>
> My guess is that on Lars new system the daylight is NOT set, then the
> mktime fail to determine the Daylight Savings and return error (-1).
>
> Erez
>
> -----Original Message-----
> From: Richard Cochran <richardcoch...@gmail.com>
> Sent: Tuesday, 20 April 2021 16:05
> To: Lars Munch <l...@segv.dk>
> 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 to be initialized to make sure mktime does not fail or
> > calculates the wrong time.
>
> No, take a look at the mktime(3) man page.  There you will read the
> following.
>
>        The  mktime() function modifies the fields of the tm structure as
> fol‐
>        lows: tm_wday and tm_yday are set to values determined from  the
> con‐
>        tents  of  the  other  fields;  if structure members are outside
> their
>        valid interval, they will be normalized (so that, for example, 40
> Oc‐
>        tober  is changed into 9 November); tm_isdst is set (regardless of
> its
>        initial value) to a positive value or to 0, respectively, to
> indicate
>        whether DST is or is not in effect at the specified time.
>
> Thanks,
> Richard
>
>
> _______________________________________________
> Linuxptp-devel mailing list
> Linuxptp-devel@lists.sourceforge.net
>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Flinuxptp-devel&amp;data=04%7C01%7Cerez.geva.ext%40siemens.com%7C6b9d88bf27584b2d9eb508d9040556d6%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637545243247255579%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=wHxP0yERXKP6unOP1ZPV%2F87BVduutafEUIOl8jH%2Bud4%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