[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [info-gnuastro] Gnuastro 0.12 released

From: Alexey Dokuchaev
Subject: Re: [info-gnuastro] Gnuastro 0.12 released
Date: Fri, 22 May 2020 11:53:47 +0000

On Wed, May 20, 2020 at 05:15:51PM +0100, Mohammad Akhlaghi wrote:
> Hello,
> I am happy to announce the 12th stable version of GNU Astronomy
> Utilities (Gnuastro):

Hi Mohammad,

I guess I've slacked a bit this time and did not test the alpha
version, so delaying FreeBSD port update would be my punishment.

The problem is with bug #57995, or more precisely, with the commit
which attempts to correct it.

Actually, there are two problems with it.  First, it does not
look right to me that you're subtracting "daylight", as per the
comment in the <time.h> it is a flag if daylight-saving time is
ever in use.  I don't think it's correct to do the math on its
value (true/false), e.g., subtract from time_t which is seconds).

I believe you just need to subtract the timezone (the UTC offset)
as it already should include any required DST adjustment, but I'm
not an expert on those things.

Second, the code is not portable.  While X/Open XSI does specify
both global variables, implementations typically discourage the
use of external variables; the tm_zone entry in the tm structure
is preferred.  Consider the following pseudo-code which should
work everywhere:

    t = mktime(&tp);
     * The function localtime() converts the time value pointed
     * by parameter, and returns pointer to a "struct tm" internal
     * static object which contains the information for the current
     * time zone and other factors such as Daylight Saving Time).
    t += localtime(&t)->tm_gmtoff;

Ideally, perhaps you should also check for mktime() return value
(if the time cannot be represented, it returns -1) but I guess you
are aware of that and know what you're going.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]