Some time_t/int conversions

This commit is contained in:
Michiel Broek 2005-10-16 11:37:54 +00:00
parent 47e52ffb35
commit eef02cca1a
7 changed files with 37 additions and 31 deletions

View File

@ -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

View File

@ -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();
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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++;
}

View File

@ -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");