Hello Andrea.

a.bia...@tiscali.it wrote in
 <20211109122644.69b13833@alice.paese.meraviglie>:
 |On Mon, 08 Nov 2021 22:39:38 +0100, Steffen Nurpmeso
 |<stef...@sdaoden.eu> wrote:
 |
 |> [...]
 |>|and work out the difference between g and l by checking the members
 |>|(e.g. normalizing to either number of minutes) with something like:
 |>|
 |>|  diff = (l->tm_sec-g->tm_sec)/60
 |>|  +(l->tm_min-g->tm_min)
 |>|  +(l->tm_hour-g->tm_hour)*60
 |>|  /* + compensate for day/month/year difference */
 |>|
 |>|I'm happy to put some code together if you want. Or test a patch,
 |> if you |prefer.
 |> 
 |> That day-of-year / dateborder approach as is used by all other
 |> MUAs was a great hint, thank you, Andrea!
 |> Yes i did it like that as a fallback if tm_gmtoff is not
 |> available, and from some testing it works fine.
 |> 
 |> Thanks again for this report, and also the hint.
 |> Let's see whether i can release this week.
 |
 |No problem, Steffen.
 |
 |I was looking into postfix sourcecode yesterday, for something else,
 |and there's an elegant (and portable) solution right in mail_date.c
 |(https://github.com/vdukhovni/postfix/blob/master/postfix/src/global/mai\
 |l_date.c).

Hmm, i see.  No, i think Alpine and mutt have the better approach,
using day-of-year looks better to me, you end up with

   rv = ((((localp_or_nil->tm_hour - utcp_or_nil->tm_hour) * 60) +
         (localp_or_nil->tm_min - utcp_or_nil->tm_min)) * 60) +
         (localp_or_nil->tm_sec - utcp_or_nil->tm_sec);

   if((t = (localp_or_nil->tm_yday - utcp_or_nil->tm_yday)) != 0)
      rv += (t == 1) ? su_TIME_DAY_SECS : -S(s64,su_TIME_DAY_SECS);

Seconds is likely stupid but so i am ;)

 |For the record, I read somewhere on the icann mailing list archive that
 |Morocco has the same problem (negative adjustments) re. Ramadan.
 |
 |Andrea.

Ciao Andrea!

 --End of <20211109122644.69b13833@alice.paese.meraviglie>

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

Reply via email to