Changeset 6646fdb for message.c


Ignore:
Timestamp:
Sep 7, 2011, 10:06:08 AM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.9
Children:
732d5c0, bcb84df
Parents:
3b17b57
git-author:
David Benjamin <davidben@mit.edu> (08/01/11 02:03:32)
git-committer:
David Benjamin <davidben@mit.edu> (09/07/11 10:06:08)
Message:
Restore correct semantics of message 'time' attribute

This rewrites part of 4ebbfbc5360fa004637dd101f5a0c833cdccd60a. We can't
replace every instance of ctime with a user-formatted time, as the time
attribute is not user-formatted. It is (unfortunately) the API for perl
to override the timestamp and owl_perlconfig_hashref2message expects a
particular format for strptime. We should not then flip the values
around once they reach C. (Especially not a locale-dependent one.)

Rename *_to_timestr functions to owl_util_format_* so it is clear the
function should only be used for user-formatted times.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    rb9517cf r6646fdb  
    4343  /* save the time */
    4444  m->time = time(NULL);
    45   m->timestr = owl_util_time_to_timestr(localtime(&m->time));
     45  m->timestr = g_strdup(ctime(&m->time));
     46  m->timestr[strlen(m->timestr)-1] = '\0';
    4647
    4748  m->fmtext = NULL;
     
    344345  if (m->timestr) return(m->timestr);
    345346  return("");
     347}
     348
     349CALLER_OWN char *owl_message_format_time(const owl_message *m)
     350{
     351  return owl_util_format_time(localtime(&m->time));
    346352}
    347353
     
    793799  if (m->timestr) g_free(m->timestr);
    794800  m->time = n->z_time.tv_sec;
    795   m->timestr = owl_util_time_to_timestr(localtime(&m->time));
     801  m->timestr = g_strdup(ctime(&m->time));
     802  m->timestr[strlen(m->timestr)-1] = '\0';
    796803
    797804  /* set other info */
Note: See TracChangeset for help on using the changeset viewer.