Changeset 4ebbfbc
- Timestamp:
- Jul 23, 2011, 8:26:03 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.9
- Children:
- e5baf0a, c36f4d0
- Parents:
- a7fac14
- git-author:
- Jason Gross <jgross@mit.edu> (07/22/11 10:43:43)
- git-committer:
- Jason Gross <jgross@mit.edu> (07/23/11 20:26:03)
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r6500907 r4ebbfbc 1223 1223 void G_GNUC_PRINTF(1, 2) owl_function_debugmsg(const char *fmt, ...) 1224 1224 { 1225 char *tmpbuff; 1225 1226 FILE *file; 1226 1227 time_t now; … … 1237 1238 now = time(NULL); 1238 1239 1239 fprintf(file, "[%d - %.24s - %lds]: ", 1240 (int) getpid(), ctime(&now), now - owl_global_get_starttime(&g)); 1240 tmpbuff = owl_util_time_to_timestr(localtime(&now)); 1241 fprintf(file, "[%d - %s - %lds]: ", 1242 (int) getpid(), tmpbuff, now - owl_global_get_starttime(&g)); 1243 g_free(tmpbuff); 1241 1244 vfprintf(file, fmt, ap); 1242 1245 putc('\n', file); … … 1761 1764 void owl_function_status(void) 1762 1765 { 1766 char *tmpbuff; 1763 1767 char buff[MAXPATHLEN+1]; 1764 1768 time_t start; … … 1788 1792 owl_fmtext_append_normal(&fm, "\n"); 1789 1793 1790 owl_fmtext_appendf_normal(&fm, " Startup Time: %s", ctime(&start)); 1794 tmpbuff = owl_util_time_to_timestr(localtime(&start)); 1795 owl_fmtext_appendf_normal(&fm, " Startup Time: %s\n", tmpbuff); 1796 g_free(tmpbuff); 1791 1797 1792 1798 up=owl_global_get_runtime(&g); … … 3409 3415 char *buff; 3410 3416 3411 now=time(NULL); 3412 date=g_strdup(ctime(&now)); 3413 date[strlen(date)-1]='\0'; 3417 now = time(NULL); 3418 date = owl_util_time_to_timestr(localtime(&now)); 3414 3419 3415 3420 buff = g_strdup_printf("%s %s", date, string); -
message.c
r6500907 r4ebbfbc 46 46 47 47 /* save the time */ 48 m->time=time(NULL); 49 m->timestr=g_strdup(ctime(&(m->time))); 50 m->timestr[strlen(m->timestr)-1]='\0'; 48 m->time = time(NULL); 49 m->timestr = owl_util_time_to_timestr(localtime(&m->time)); 51 50 52 51 m->fmtext = NULL; … … 796 795 /* save the time, we need to nuke the string saved by message_init */ 797 796 if (m->timestr) g_free(m->timestr); 798 m->time=n->z_time.tv_sec; 799 m->timestr=g_strdup(ctime(&(m->time))); 800 m->timestr[strlen(m->timestr)-1]='\0'; 797 m->time = n->z_time.tv_sec; 798 m->timestr = owl_util_time_to_timestr(localtime(&m->time)); 801 799 802 800 /* set other info */ -
perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm
r7aa1fa5 r4ebbfbc 29 29 use BarnOwl; 30 30 use BarnOwl::Message::Twitter; 31 use POSIX qw( asctime);31 use POSIX qw(strftime); 32 32 33 33 use LWP::UserAgent; … … 247 247 ($self->{cfg}->{account_nickname} ? 248 248 "[$self->{cfg}->{account_nickname}]" : "") . 249 ": ratelimited until " . asctime(localtime($timeout)));249 ": ratelimited until " . strftime('%c', localtime($timeout))); 250 250 } elsif(exists($ratelimit->{error})) { 251 251 $self->sleep(60*20); -
util.c
r8219374 r4ebbfbc 296 296 } 297 297 298 CALLER_OWN char *owl_util_time_to_timestr(const struct tm *time) 299 { 300 /* 32 chosen for first attempt because timestr will end up being 301 * something like "Www Mmm dd hh:mm:ss AM yyyy UTC\0" */ 302 size_t timestr_size = 16; 303 char *timestr = NULL; 304 do { 305 timestr_size *= 2; 306 timestr = g_renew(char, timestr, timestr_size); 307 } while (strftime(timestr, timestr_size, "%c", time) == 0); 308 return timestr; 309 } 310 298 311 /* These are in order of their value in owl.h */ 299 312 static const struct {
Note: See TracChangeset
for help on using the changeset viewer.