Clean up SCLocalTime() usage

Remove cast of return type from SCLocalTime() as it is not needed.
Replace last use of localtime_r() with SCLocalTime().
pull/514/merge
Ken Steele 12 years ago committed by Victor Julien
parent 77fae5313d
commit d4dd18eb85

@ -1049,7 +1049,7 @@ static int SCPerfOutputCounterFileIface()
gettimeofday(&tval, NULL);
struct tm local_tm;
tms = (struct tm *)SCLocalTime(tval.tv_sec, &local_tm);
tms = SCLocalTime(tval.tv_sec, &local_tm);
/* Calculate the Engine uptime */
int up_time = (int)difftime(tval.tv_sec, sc_start_time);

@ -210,7 +210,7 @@ int SetupFPAnalyzer(void)
struct tm *tms;
gettimeofday(&tval, NULL);
struct tm local_tm;
tms = (struct tm *)SCLocalTime(tval.tv_sec, &local_tm);
tms = SCLocalTime(tval.tv_sec, &local_tm);
fprintf(fp_engine_analysis_FD, "----------------------------------------------"
"---------------------\n");
fprintf(fp_engine_analysis_FD, "Date: %" PRId32 "/%" PRId32 "/%04d -- "
@ -257,7 +257,7 @@ int SetupRuleAnalyzer(void)
struct tm *tms;
gettimeofday(&tval, NULL);
struct tm local_tm;
tms = (struct tm *)localtime_r(&tval.tv_sec, &local_tm);
tms = SCLocalTime(tval.tv_sec, &local_tm);
fprintf(rule_engine_analysis_FD, "----------------------------------------------"
"---------------------\n");
fprintf(rule_engine_analysis_FD, "Date: %" PRId32 "/%" PRId32 "/%04d -- "

@ -156,7 +156,7 @@ static void LogHttpLogCustom(LogHttpLogThread *aft, htp_tx_t *tx, const struct t
time_t time = ts->tv_sec;
struct tm local_tm;
struct tm *timestamp = (struct tm *)SCLocalTime(time, &local_tm);
struct tm *timestamp = SCLocalTime(time, &local_tm);
for (i = 0; i < httplog_ctx->cf_n; i++) {
switch (httplog_ctx->cf_nodes[i]->type){

@ -272,7 +272,7 @@ TmEcode PcapLog (ThreadVars *t, Packet *p, void *data, PacketQueue *pq,
if (pl->mode == LOGMODE_SGUIL) {
struct tm local_tm;
struct tm *tms = (struct tm *)SCLocalTime(p->ts.tv_sec, &local_tm);
struct tm *tms = SCLocalTime(p->ts.tv_sec, &local_tm);
if (tms->tm_mday != pl->prev_day) {
rotate = 1;
pl->prev_day = tms->tm_mday;
@ -342,7 +342,7 @@ TmEcode PcapLogDataInit(ThreadVars *t, void *initdata, void **data)
memset(&ts, 0x00, sizeof(struct timeval));
TimeGet(&ts);
struct tm local_tm;
struct tm *tms = (struct tm *)SCLocalTime(ts.tv_sec, &local_tm);
struct tm *tms = SCLocalTime(ts.tv_sec, &local_tm);
pl->prev_day = tms->tm_mday;
*data = (void *)pl;
@ -612,7 +612,7 @@ int PcapLogOpenFileCtx(PcapLogData *pl)
if (pl->mode == LOGMODE_SGUIL) {
struct tm local_tm;
struct tm *tms = (struct tm *)SCLocalTime(ts.tv_sec, &local_tm);
struct tm *tms = SCLocalTime(ts.tv_sec, &local_tm);
char dirname[32], dirfull[PATH_MAX] = "";

@ -359,7 +359,7 @@ SCProfilingRuleDump(SCProfileDetectCtx *rules_ctx)
gettimeofday(&tval, NULL);
struct tm local_tm;
tms = (struct tm *)SCLocalTime(tval.tv_sec, &local_tm);
tms = SCLocalTime(tval.tv_sec, &local_tm);
fprintf(fp, " ----------------------------------------------"
"----------------------------\n");

Loading…
Cancel
Save