From eef02cca1abba1b157cbd83c38edd6237d19cfa5 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 16 Oct 2005 11:37:54 +0000 Subject: [PATCH] Some time_t/int conversions --- ChangeLog | 6 ++++++ mbcico/answer.c | 6 +++--- mbcico/dial.c | 4 ++-- mbcico/mbcico.c | 4 ++-- mbcico/opentcp.c | 4 ++-- mbfido/rollover.c | 32 ++++++++++++++++---------------- mbsetup/m_node.c | 12 ++++++------ 7 files changed, 37 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8e33544..1b334dc0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,12 @@ $Id$ v0.81.2 14-Oct-2005. + mbcico: + Some time_t/int conversions. + + mbfido: + Some time_t/int conversions. + v0.81.1 09-Oct-2005 - 14-Oct-2005 diff --git a/mbcico/answer.c b/mbcico/answer.c index e0e837f6..c280fce2 100644 --- a/mbcico/answer.c +++ b/mbcico/answer.c @@ -130,8 +130,8 @@ int answer(char *stype) c_end = time(NULL); online += (c_end - c_start); - history.online = c_start; - history.offline = c_end; + history.online = (int)c_start; + history.offline = (int)c_end; history.sent_bytes = sentbytes; history.rcvd_bytes = rcvdbytes; history.inbound = TRUE; @@ -147,7 +147,7 @@ int answer(char *stype) free(p); if (Loaded) { - nodes.LastDate = time(NULL); + nodes.LastDate = (int32_t)time(NULL); UpdateNode(); } } diff --git a/mbcico/dial.c b/mbcico/dial.c index 3e79d4ad..13d01984 100644 --- a/mbcico/dial.c +++ b/mbcico/dial.c @@ -121,8 +121,8 @@ int hangup() online += (c_end - c_start); Syslog('+', "Connection time %s", t_elapsed(c_start, c_end)); carrier = FALSE; - history.offline = c_end; - history.online = c_start; + history.offline = (int)c_end; + history.online = (int)c_start; history.sent_bytes = sentbytes; history.rcvd_bytes = rcvdbytes; history.inbound = ~master; diff --git a/mbcico/mbcico.c b/mbcico/mbcico.c index a5a336f6..eaf0d69c 100644 --- a/mbcico/mbcico.c +++ b/mbcico/mbcico.c @@ -214,8 +214,8 @@ int main(int argc, char *argv[]) WriteError("$Can't create %s", cmd); } else { memset(&history, 0, sizeof(history)); - history.online = time(NULL); - history.offline = time(NULL); + history.online = (int)time(NULL); + history.offline = (int)time(NULL); fwrite(&history, sizeof(history), 1, fp); fclose(fp); Syslog('+', "Created new %s", cmd); diff --git a/mbcico/opentcp.c b/mbcico/opentcp.c index ee3a9a65..d6d50a9b 100644 --- a/mbcico/opentcp.c +++ b/mbcico/opentcp.c @@ -189,8 +189,8 @@ void closetcp(void) online += (c_end - c_start); Syslog('+', "Closing TCP connection, connected %s", t_elapsed(c_start, c_end)); carrier = FALSE; - history.offline = c_end; - history.online = c_start; + history.offline = (int)c_end; + history.online = (int)c_start; history.sent_bytes = sentbytes; history.rcvd_bytes = rcvdbytes; history.inbound = ~master; diff --git a/mbfido/rollover.c b/mbfido/rollover.c index dc4e2cc8..67e1333f 100644 --- a/mbfido/rollover.c +++ b/mbfido/rollover.c @@ -53,11 +53,11 @@ void RollWeek(statcnt *S) for (i = 0; i < 7; i++) { S->ldow[i] = S->tdow[i]; - S->tdow[i] = 0L; + S->tdow[i] = 0; } S->lweek = S->tweek; - S->tweek = 0L; + S->tweek = 0; if (CFG.slow_util && do_quiet) msleep(1); @@ -109,7 +109,7 @@ void Rollover() if ((fp = OpenData((char *)"nodes.data")) != NULL) { fread(&nodeshdr, sizeof(nodeshdr), 1, fp); - Temp = nodeshdr.lastupd; + Temp = (time_t)nodeshdr.lastupd; t = localtime(&Temp); /* @@ -161,7 +161,7 @@ void Rollover() } fseek(fp, 0, SEEK_SET); - nodeshdr.lastupd = time(NULL); + nodeshdr.lastupd = (int)time(NULL); fwrite(&nodeshdr, nodeshdr.hdrsize, 1, fp); } @@ -170,7 +170,7 @@ void Rollover() if ((fp = OpenData((char *)"mareas.data")) != NULL) { fread(&msgshdr, sizeof(msgshdr), 1, fp); - Temp = msgshdr.lastupd; + Temp = (time_t)msgshdr.lastupd; t = localtime(&Temp); if (((Diw == 0) && (Day != t->tm_yday)) || ((Day - t->tm_yday) > 7)) @@ -240,7 +240,7 @@ void Rollover() fwrite(&mgroup, mgrouphdr.recsize, 1, fp); } - mgrouphdr.lastupd = time(NULL); + mgrouphdr.lastupd = (int)time(NULL); fseek(fp, 0, SEEK_SET); fwrite(&mgrouphdr, mgrouphdr.hdrsize, 1, fp); } @@ -249,7 +249,7 @@ void Rollover() if ((fp = OpenData((char *)"tic.data")) != NULL) { fread(&tichdr, sizeof(tichdr), 1, fp); - Temp = tichdr.lastupd; + Temp = (time_t)tichdr.lastupd; t = localtime(&Temp); if (((Diw == 0) && (Day != t->tm_yday)) || ((Day - t->tm_yday) > 7)) @@ -280,7 +280,7 @@ void Rollover() fseek(fp, tichdr.syssize, SEEK_CUR); } - tichdr.lastupd = time(NULL); + tichdr.lastupd = (int)time(NULL); fseek(fp, 0, SEEK_SET); fwrite(&tichdr, tichdr.hdrsize, 1, fp); } @@ -289,7 +289,7 @@ void Rollover() if ((fp = OpenData((char *)"fgroups.data")) != NULL) { fread(&fgrouphdr, sizeof(fgrouphdr), 1, fp); - Temp = fgrouphdr.lastupd; + Temp = (time_t)fgrouphdr.lastupd; t = localtime(&Temp); if (((Diw == 0) && (Day != t->tm_yday)) || ((Day - t->tm_yday) > 7)) @@ -319,7 +319,7 @@ void Rollover() fwrite(&fgroup, fgrouphdr.recsize, 1, fp); } - fgrouphdr.lastupd = time(NULL); + fgrouphdr.lastupd = (int)time(NULL); fseek(fp, 0, SEEK_SET); fwrite(&fgrouphdr, fgrouphdr.hdrsize, 1, fp); } @@ -328,7 +328,7 @@ void Rollover() if ((fp = OpenData((char *)"hatch.data")) != NULL) { fread(&hatchhdr, sizeof(hatchhdr), 1, fp); - Temp = hatchhdr.lastupd; + Temp = (time_t)hatchhdr.lastupd; t = localtime(&Temp); if (((Diw == 0) && (Day != t->tm_yday)) || ((Day - t->tm_yday) > 7)) @@ -355,7 +355,7 @@ void Rollover() fwrite(&hatch, hatchhdr.recsize, 1, fp); } - hatchhdr.lastupd = time(NULL); + hatchhdr.lastupd = (int)time(NULL); fseek(fp, 0, SEEK_SET); fwrite(&hatchhdr, hatchhdr.hdrsize, 1, fp); } @@ -367,7 +367,7 @@ void Rollover() snprintf(temp, PATH_MAX, "%s/var/mailer.hist", getenv("MBSE_ROOT")); if ((fp = fopen(temp, "r"))) { fread(&history, sizeof(history), 1, fp); - Temp = history.online; + Temp = (time_t)history.online; t = localtime(&Temp); if (t->tm_mon != Miy) { /* @@ -392,13 +392,13 @@ void Rollover() fclose(fp); } else { memset(&history, 0, sizeof(history)); - history.online = time(NULL); - history.offline = time(NULL); + history.online = (int)time(NULL); + history.offline = (int)time(NULL); fwrite(&history, sizeof(history), 1, ft); i = 0; while (fread(&history, sizeof(history), 1, fp)) { - if (history.online >= Now) { + if (history.online >= (int)Now) { fwrite(&history, sizeof(history), 1, ft); i++; } diff --git a/mbsetup/m_node.c b/mbsetup/m_node.c index 2cf4fb98..f939aed1 100644 --- a/mbsetup/m_node.c +++ b/mbsetup/m_node.c @@ -537,17 +537,17 @@ void S_Stat(void) else LMiy = Miy - 1; - mbse_mvprintw(10,18, (char *)"%10lu %10lu %10lu %10lu %10lu", nodes.FilesSent.tweek, + mbse_mvprintw(10,18, (char *)"%10u %10u %10u %10u %10u", nodes.FilesSent.tweek, nodes.FilesSent.lweek, nodes.FilesSent.month[Miy], nodes.FilesSent.month[LMiy], nodes.FilesSent.total); - mbse_mvprintw(11,18, (char *)"%10lu %10lu %10lu %10lu %10lu", nodes.F_KbSent.tweek, + mbse_mvprintw(11,18, (char *)"%10u %10u %10u %10u %10u", nodes.F_KbSent.tweek, nodes.F_KbSent.lweek, nodes.F_KbSent.month[Miy], nodes.F_KbSent.month[LMiy], nodes.F_KbSent.total); - mbse_mvprintw(12,18, (char *)"%10lu %10lu %10lu %10lu %10lu", nodes.FilesRcvd.tweek, + mbse_mvprintw(12,18, (char *)"%10u %10u %10u %10u %10u", nodes.FilesRcvd.tweek, nodes.FilesRcvd.lweek, nodes.FilesRcvd.month[Miy], nodes.FilesRcvd.month[LMiy], nodes.FilesRcvd.total); - mbse_mvprintw(13,18, (char *)"%10lu %10lu %10lu %10lu %10lu", nodes.F_KbRcvd.tweek, + mbse_mvprintw(13,18, (char *)"%10u %10u %10u %10u %10u", nodes.F_KbRcvd.tweek, nodes.F_KbRcvd.lweek, nodes.F_KbRcvd.month[Miy], nodes.F_KbRcvd.month[LMiy], nodes.F_KbRcvd.total); - mbse_mvprintw(14,18, (char *)"%10lu %10lu %10lu %10lu %10lu", nodes.MailSent.tweek, + mbse_mvprintw(14,18, (char *)"%10u %10u %10u %10u %10u", nodes.MailSent.tweek, nodes.MailSent.lweek, nodes.MailSent.month[Miy], nodes.MailSent.month[LMiy], nodes.MailSent.total); - mbse_mvprintw(15,18, (char *)"%10lu %10lu %10lu %10lu %10lu", nodes.MailRcvd.tweek, + mbse_mvprintw(15,18, (char *)"%10u %10u %10u %10u %10u", nodes.MailRcvd.tweek, nodes.MailRcvd.lweek, nodes.MailRcvd.month[Miy], nodes.MailRcvd.month[LMiy], nodes.MailRcvd.total); set_color(CYAN, BLACK); center_addstr(LINES - 4, (char *)"Press any key");