Hi Steffen.

On 2022-08-01T15:02:29TAI, Steffen Nurpmeso wrote:
> And localtime(3), on Linux, usually works according to /etc/localtime.
>
And localtime() fills a struct tm,
which has tm_gmtoff,
which contains fractions of a minute in my case (tm_gmtoff%60 equals 37 
currently),
which RFC5322 cannot represent,
because it does not want to show the GMT offset accurately enough...

example:
% cat a.c
#include <time.h>
#include <stdio.h>

int main() {
        time_t now = time(0);
        struct tm * t;
        t = localtime(&now);
        printf("localtime: gmtoff:%d gmtoff%60:%d\n", t->tm_gmtoff, 
t->tm_gmtoff%60);
        t = gmtime(&now);
        printf("gmtime: gmtoff:%d gmtoff%60:%d\n", t->tm_gmtoff, 
t->tm_gmtoff%60);
        return 0;
}
% c++ -o a a.c -O3
% ./a
localtime: gmtoff:37 gmtoff%60:37
gmtime: gmtoff:0 gmtoff%60:0

> How should i detect this?
>
U could check if gmtoff%60 is non-zero after a localtime() call,
and
if yes, then u switch to gmtime, which should do the trick.

> So then.  And exim fits that perfect environment?
>
exim handles this situation properly now, I think...
https://bugs.exim.org/show_bug.cgi?id=2530

-arne

Reply via email to