Changeset 0071c88 for functions.c


Ignore:
Timestamp:
Aug 1, 2011, 11:28:43 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Children:
2e42098
Parents:
9078f69
git-author:
David Benjamin <davidben@mit.edu> (08/01/11 02:03:32)
git-committer:
David Benjamin <davidben@mit.edu> (08/01/11 23:28:43)
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
  • functions.c

    rb9517cf r0071c88  
    12291229  now = time(NULL);
    12301230
    1231   tmpbuff = owl_util_time_to_timestr(localtime(&now));
     1231  tmpbuff = owl_util_format_time(localtime(&now));
    12321232  fprintf(file, "[%d -  %s - %lds]: ",
    12331233          (int) getpid(), tmpbuff, now - owl_global_get_starttime(&g));
     
    13791379  owl_fmtext fm, attrfm;
    13801380  const owl_view *v;
     1381  char *time;
    13811382#ifdef HAVE_LIBZEPHYR
    13821383  const ZNotice_t *n;
     
    14091410  }
    14101411
    1411   owl_fmtext_appendf_normal(&fm, "  Time      : %s\n", owl_message_get_timestr(m));
     1412  time = owl_message_format_time(m);
     1413  owl_fmtext_appendf_normal(&fm, "  Time      : %s\n", time);
     1414  g_free(time);
    14121415
    14131416  if (!owl_message_is_type_admin(m)) {
     
    17821785  owl_fmtext_append_normal(&fm, "\n");
    17831786
    1784   tmpbuff = owl_util_time_to_timestr(localtime(&start));
     1787  tmpbuff = owl_util_format_time(localtime(&start));
    17851788  owl_fmtext_appendf_normal(&fm, "  Startup Time: %s\n", tmpbuff);
    17861789  g_free(tmpbuff);
     
    30783081      idle=owl_buddy_get_idle_time(b);
    30793082      if (idle!=0) {
    3080         timestr=owl_util_minutes_to_timestr(idle);
     3083        timestr=owl_util_format_minutes(idle);
    30813084      } else {
    30823085        timestr=g_strdup("");
     
    34073410
    34083411  now = time(NULL);
    3409   date = owl_util_time_to_timestr(localtime(&now));
     3412  date = owl_util_format_time(localtime(&now));
    34103413
    34113414  buff = g_strdup_printf("%s %s", date, string);
Note: See TracChangeset for help on using the changeset viewer.