FreeBSD Bugzilla – Attachment 229808 Details for
Bug 260137
mail/heirloom-mailx: wrong UTC offset in Date header for Europe/Dublin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
correct calculation of GMT/UTC offset
patch-gmt-offset (text/plain), 2.17 KB, created by
Andrea Biardi
on 2021-11-30 10:28:34 UTC
(
hide
)
Description:
correct calculation of GMT/UTC offset
Filename:
MIME Type:
Creator:
Andrea Biardi
Created:
2021-11-30 10:28:34 UTC
Size:
2.17 KB
patch
obsolete
>--- head.c 2006-03-04 00:32:16.000000000 +0000 >+++ head.c 2021-11-29 21:35:12.043385175 +0000 >@@ -1116,10 +1116,8 @@ > if ((t = combinetime(year, month, day, hour, minute, second)) == > (time_t)-1) > goto invalid; >- tzdiff = t - mktime(gmtime(&t)); > tmptr = localtime(&t); >- if (tmptr->tm_isdst > 0) >- tzdiff += 3600; >+ tzdiff = tmptr->tm_gmtoff; /* seconds east of GMT */ > t -= tzdiff; > return t; > invalid: >--- imap.c 2009-03-13 15:39:15.000000000 +0000 >+++ imap.c 2021-11-29 21:29:26.885202809 +0000 >@@ -3530,10 +3530,8 @@ > return -1; > if ((t = combinetime(year, month, day, 0, 0, 0)) == (time_t)-1) > return -1; >- tzdiff = t - mktime(gmtime(&t)); > tmptr = localtime(&t); >- if (tmptr->tm_isdst > 0) >- tzdiff += 3600; >+ tzdiff = tmptr->tm_gmtoff; /* seconds east of GMT */ > t -= tzdiff; > return t; > } >@@ -3545,13 +3543,11 @@ > struct tm *tmptr; > int tzdiff, tzdiff_hour, tzdiff_min; > >- tzdiff = t - mktime(gmtime(&t)); >+ tmptr = localtime(&t); >+ tzdiff = tmptr->tm_gmtoff; /* seconds east of GMT */ > tzdiff_hour = (int)(tzdiff / 60); > tzdiff_min = tzdiff_hour % 60; > tzdiff_hour /= 60; >- tmptr = localtime(&t); >- if (tmptr->tm_isdst > 0) >- tzdiff_hour++; > snprintf(s, sizeof s, "\"%02d-%s-%04d %02d:%02d:%02d %+03d%02d\"", > tmptr->tm_mday, > month_names[tmptr->tm_mon], >--- sendout.c 2009-03-01 20:25:42.000000000 +0000 >+++ sendout.c 2021-11-29 19:35:39.421305295 +0000 >@@ -1123,9 +1123,7 @@ > > /* > * Create a Date: header field. >- * We compare the localtime() and gmtime() results to get the timezone, >- * because numeric timezones are easier to read and because $TZ is >- * not set on most GNU systems. >+ * We use tm->tm_gmtoff to account for negative DST adjustments (e.g. Ireland). > */ > int > mkdate(FILE *fo, const char *field) >@@ -1135,13 +1133,11 @@ > int tzdiff, tzdiff_hour, tzdiff_min; > > time(&t); >- tzdiff = t - mktime(gmtime(&t)); >+ tmptr = localtime(&t); >+ tzdiff = tmptr->tm_gmtoff; /* seconds east of GMT */ > tzdiff_hour = (int)(tzdiff / 60); > tzdiff_min = tzdiff_hour % 60; > tzdiff_hour /= 60; >- tmptr = localtime(&t); >- if (tmptr->tm_isdst > 0) >- tzdiff_hour++; > return fprintf(fo, "%s: %s, %02d %s %04d %02d:%02d:%02d %+05d\n", > field, > weekday_names[tmptr->tm_wday],
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 260137
: 229808