[Pidgin] #3550: PurpleLog::time is wrong

Pidgin trac at pidgin.im
Sun Oct 14 15:24:46 EDT 2007


#3550: PurpleLog::time is wrong
---------------------------+------------------------------------------------
  Reporter:  xpertbg       |       Owner:       
      Type:  defect        |      Status:  new  
  Priority:  minor         |   Milestone:       
 Component:  pidgin (gtk)  |     Version:  2.2.1
Resolution:                |    Keywords:       
   Pending:  1             |  
---------------------------+------------------------------------------------
Changes (by xpertbg):

  * pending:  1 => 0

Comment:

 I'm sorry, problem with the copy-paste.

 The code which produce the correct output is:

  header = g_strdup_printf(_("<b>My Conversation with %s on %s ||
 %s:</b><br>"), alias,
  purple_date_format_full(((PurpleLog? *)logs->data)->tm),
  purple_date_format_full(localtime(&((PurpleLog? *)logs->data)->time)) );

 if I furst use tm and then time everything is ok. I tried few more things
 lately, and found out that this code produce wrong output:

  time_t now;[[BR]]
  time(&now);[[BR]]
  struct tm* bdt = localtime(&now);[[BR]]
  asctime( bdt ) // the result of this function is one hour in the future

 Here is one more thing to think about:
  time_t     last;[[BR]]
  time(&last);[[BR]]
  time_t now;[[BR]]
  time(&now);[[BR]]
  struct tm* bdt = localtime(&now);[[BR]]
  .......[[BR]]
  while(...)[[BR]]
  {
   ...[[BR]]
   header = g_strdup_printf(_("<b>My Conversation with %s on %s
 now=%s:</b><br>"), alias,[[BR]]
      purple_date_format_full( localtime(&((PurpleLog *)logs->data)->time)
 ),[[BR]]
      asctime( bdt ) );[[BR]]
   gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), header,
 options);[[BR]]
   g_free(header);[[BR]]
   ...[[BR]]
  }[[BR]]

 The function asctime( bdt ) does not produce the same result each time. It
 does not make much sense because the time is already splitet to
 day/hour/minute and so on. Here is the result:[[BR]]
  My Conversation with deizi on 14.10.2007 (нд) 23,06,25 EEST now=Sun Oct
 14 22:44:26 2007 :[[BR]]
  ...[[BR]]
  My Conversation with deizi on 14.10.2007 (нд) 23,07,10 EEST now=Sun Oct
 14 23:06:25 2007 :[[BR]]

 I would use this tm to display the time, if there was not the other
 problem: I want to display the history messages from the past few
 hours(which I made configurable), but the calculation is wrong and one
 more hour is displayed.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/3550#comment:2>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list