Re: [evolution-patches] Fix for 72308 - date field being displayed in GMT




Lots of problems here:
- localtime was not re-entrant, all camel code should be re-entrant (for threading)
- ctime is similarlly not re-entrant, so you cannot use it
- camel_header_decode_date parses rfc822 dates.  ctime is not an rfc822 date, so you can't use its output to feed it (we have workaroudn code for broken mailers which do this, but we should definitely not do this internally)
- it can't possibly calculate the offset properly from a ctime since ctime is localised

You probably just want to use e_localtime_with_offset() from libedataserver/e-time-utils.h since i presume the time string is gmt or something and you just want the locally adjusted version + the local timezone offset.

On Thu, 2005-02-17 at 14:32 +0530, Parthasarathi Susarla wrote:
        dtstring = e_gw_item_get_creation_date (item) ;
        if(dtstring) {
+               int offset = 0 ;
                time_t time = e_gw_connection_get_date_from_string (dtstring) ;
-               struct tm *tm = localtime (&time) ;
-               time_t actual_time = mktime (tm) ;
-               camel_mime_message_set_date (msg, actual_time, 0) ;
+               time_t actual_time = camel_header_decode_date (ctime(&time), &offset) ;
+               g_print ("offset:%d\n",offset) ;
+               camel_mime_message_set_date (msg, actual_time, offse


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