On Wed, 2005-05-11 at 21:36 +0000, Aaron Stone wrote:
> OK, sounds great, but please don't CC me directly in list discussions!
[[ Have your email client set a Reply-To: to the list, or a Mail-
Followup-To: to the list and I'll hit the right one. Until then, I'll
remove you manually when I see it. ]]
> Geo, would you this up as a patch against current dbmail_2_0_branch SVN?
Attached. This means dbmail will mandate GMT/UTC in the SQL-side.
--
Internet Connection High Quality Web Hosting
http://www.internetconnection.net/
Index: imaputil.c
===================================================================
--- imaputil.c (revision 1775)
+++ imaputil.c (working copy)
@@ -1784,31 +1784,23 @@
*/
char *date_sql2imap(const char *sqldate)
{
- long gmt_offset=0;
- struct tm tm_sql_date;
- char *last;
-
- /* defined by tzset */
- extern long timezone;
- timezone=0;
- tzset();
-
- last = strptime(sqldate,"%Y-%m-%d %T", &tm_sql_date);
- if ( (last == NULL) || (*last != '\0') ) {
+ unsigned long y,m,d;
+ char *mm[12] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ };
+
+ if (sscanf(sqldate, "%lu-%lu-%lu ", &y,&m,&d) < 3) {
trace(TRACE_DEBUG, "%s,%s, error parsing date [%s]",
__FILE__, __func__, sqldate);
strcpy(_imapdate, IMAP_STANDARD_DATE);
return _imapdate;
}
+ if (y < 60) y += 2000;
+ else if (y < 1000) y += 1900;
+ m--;
- gmt_offset = (-timezone)/3600;
- if (tm_sql_date.tm_isdst)
- gmt_offset++;
-
- snprintf(_imapdate,IMAP_INTERNALDATE_LEN,"%s %c%02ld00",
- sqldate,
- (gmt_offset >= 0 ? '+': '-'),
- gmt_offset);
+ sprintf(_imapdate, "%02lu-%s-%04lu +0000", d, mm[m], y);
return _imapdate;
}