Changeset 9380
- Timestamp:
- 01/17/14 16:10:34 (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oscam-log.c
r9309 r9380 211 211 { 212 212 setvbuf(fp, NULL, _IOFBF, 8 * 1024); 213 time_t t;214 213 char line[80]; 215 214 memset(line, '-', sizeof(line)); 216 215 line[(sizeof(line) / sizeof(char)) - 1] = '\0'; 217 time (&t);216 time_t walltime = cs_time(); 218 217 if(!cfg.disablelog) 219 218 { 220 219 char buf[28]; 221 cs_ctime_r(& t, buf);220 cs_ctime_r(&walltime, buf); 222 221 fprintf(fp, "\n%s\n>> OSCam << cardserver %s at %s%s\n", line, starttext, buf, line); 223 222 } … … 272 271 #endif 273 272 274 static time_tlog_ts;273 static struct timeb log_ts; 275 274 276 275 static int32_t get_log_header(int32_t m, char *txt) … … 280 279 int32_t pos; 281 280 282 time(&log_ts); 283 localtime_r(&log_ts, <); 281 cs_ftime(&log_ts); 282 time_t walltime = cs_walltime(&log_ts); 283 localtime_r(&walltime, <); 284 284 285 285 pos = snprintf(txt, LOG_BUF_SIZE, "[LOG000]%4d/%02d/%02d %02d:%02d:%02d ", lt.tm_year + 1900, lt.tm_mon + 1, lt.tm_mday, lt.tm_hour, lt.tm_min, lt.tm_sec); … … 440 440 static char dupl[LOG_BUF_SIZE / 4]; 441 441 static char last_log_txt[LOG_BUF_SIZE]; 442 static time_tlast_log_ts;442 static struct timeb last_log_ts; 443 443 static unsigned int last_log_duplicates; 444 444 … … 467 467 if(last_log_duplicates > 0) 468 468 { 469 if(! last_log_ts) // Must be initialized once469 if(!cs_valid_time(&last_log_ts)) // Must be initialized once 470 470 { last_log_ts = log_ts; } 471 471 // Report duplicated lines when the new log line is different 472 472 // than the old or 60 seconds have passed. 473 if(!repeated_line || log_ts - last_log_ts >= 60) 473 int32_t gone = comp_timeb(&log_ts, &last_log_ts); 474 if(!repeated_line || gone >= 60*1000) 474 475 { 475 476 dupl_header_len = get_log_header(2, dupl); … … 528 529 char date[9]; 529 530 unsigned char i, parity, writeheader = 0; 530 time_t t;531 531 struct tm timeinfo; 532 532 … … 542 542 543 543 /* calc log file name */ 544 time (&t);545 localtime_r(& t, &timeinfo);544 time_t walltime = cs_time(); 545 localtime_r(&walltime, &timeinfo); 546 546 strftime(date, sizeof(date), "%Y%m%d", &timeinfo); 547 547 snprintf(buf, sizeof(buf), "%s/%s_I%04X_%s.cwl", cfg.cwlogdir, date, er->srvid, srvname); … … 603 603 if(!cfg.disableuserfile) 604 604 { 605 time_t t;606 605 struct tm lt; 607 606 char buf[LOG_BUF_SIZE]; … … 609 608 float cwps; 610 609 611 time (&t);612 localtime_r(& t, <);610 time_t walltime = cs_time(); 611 localtime_r(&walltime, <); 613 612 if(client->cwfound + client->cwnot > 0) 614 613 { -
trunk/oscam-time.h
r9379 r9380 25 25 time_t cs_time(void); 26 26 27 static inline bool cs_valid_time(struct timeb *tp) { return tp->time != 0; } 28 27 29 void cs_gettime(struct timespec *ts); 28 30
Note:
See TracChangeset
for help on using the changeset viewer.