Some time_t/int conversions

This commit is contained in:
Michiel Broek 2005-10-16 12:22:30 +00:00
parent 52f0abaa13
commit 4d170675b4

View File

@ -112,8 +112,8 @@ void status_init()
stat_fd = open(stat_fn, O_RDWR); stat_fd = open(stat_fn, O_RDWR);
if (stat_fd == -1) { if (stat_fd == -1) {
memset((char *)&status, 0, sizeof(status_r)); memset((char *)&status, 0, sizeof(status_r));
status.start = time(NULL); status.start = (int)time(NULL);
status.daily = time(NULL); status.daily = (int)time(NULL);
status.sequence = (unsigned int)time(NULL); status.sequence = (unsigned int)time(NULL);
stat_fd = open(stat_fn, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); stat_fd = open(stat_fn, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
cnt = write(stat_fd, &status, sizeof(status_r)); cnt = write(stat_fd, &status, sizeof(status_r));
@ -127,7 +127,7 @@ void status_init()
exit(MBERR_INIT_ERROR); exit(MBERR_INIT_ERROR);
} }
status.startups++; status.startups++;
status.laststart = time(NULL); status.laststart = (int)time(NULL);
status.clients = 1; /* We are a client ourself */ status.clients = 1; /* We are a client ourself */
s_bbsopen = status.open; s_bbsopen = status.open;
lseek(stat_fd, 0, SEEK_SET); lseek(stat_fd, 0, SEEK_SET);
@ -155,13 +155,13 @@ void status_write(void)
temp = time(NULL); temp = time(NULL);
localtime_r(&temp, &ttm); localtime_r(&temp, &ttm);
yday = ttm.tm_yday; yday = ttm.tm_yday;
temp = status.daily; temp = (time_t)status.daily;
localtime_r(&temp, &ttm); localtime_r(&temp, &ttm);
#else #else
temp = time(NULL); temp = time(NULL);
ttm = *localtime(&temp); ttm = *localtime(&temp);
yday = ttm.tm_yday; yday = ttm.tm_yday;
temp = status.daily; // On a Sparc, first put the time in temp, then pass it to locattime. temp = (time_t)status.daily;
ttm = *localtime(&temp); ttm = *localtime(&temp);
#endif #endif
@ -320,7 +320,7 @@ char *stat_status()
for (tmpu = users; tmpu; tmpu = tmpu->next) for (tmpu = users; tmpu; tmpu = tmpu->next)
usrcnt++; usrcnt++;
snprintf(buf, 160, "100:23,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%2.2f,%u,%d,%d,%d;", snprintf(buf, 160, "100:23,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%2.2f,%u,%d,%d,%d;",
(int)status.start, (int)status.laststart, (int)status.daily, status.start, status.laststart, status.daily,
status.startups, status.clients, status.startups, status.clients,
status.total.tot_clt, status.total.peak_clt, status.total.tot_clt, status.total.peak_clt,
status.total.s_error, status.total.c_error, status.total.s_error, status.total.c_error,