Catch up with 64bit time_t on sparc64. The rstat packet expects a 32bit
time_t and times will look incorrect on machines with 64bit time_t. PR: 88788 Submitted by: Keith White <Keith.White -at- site.uottawa.ca> MFC after: 1 week
This commit is contained in:
parent
7f6ff3fe2f
commit
5df9daab27
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=153090
@ -101,6 +101,7 @@ rstat_reply(caddr_t replyp, struct sockaddr_in *raddrp)
|
||||
struct hostent *hp;
|
||||
char *host;
|
||||
statstime *host_stat = (statstime *)replyp;
|
||||
time_t tmp_time_t;
|
||||
|
||||
if (search_host(raddrp->sin_addr))
|
||||
return(0);
|
||||
@ -118,13 +119,26 @@ rstat_reply(caddr_t replyp, struct sockaddr_in *raddrp)
|
||||
|
||||
printf("%-*s\t", HOST_WIDTH, host);
|
||||
|
||||
tmp_time = localtime((time_t *)&host_stat->curtime.tv_sec);
|
||||
host_time = *tmp_time;
|
||||
if (sizeof(time_t) == sizeof(host_stat->curtime.tv_sec)) {
|
||||
tmp_time = localtime((time_t *)&host_stat->curtime.tv_sec);
|
||||
host_time = *tmp_time;
|
||||
|
||||
host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec;
|
||||
host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec;
|
||||
|
||||
tmp_time = gmtime((time_t *)&host_stat->curtime.tv_sec);
|
||||
host_uptime = *tmp_time;
|
||||
tmp_time = gmtime((time_t *)&host_stat->curtime.tv_sec);
|
||||
host_uptime = *tmp_time;
|
||||
}
|
||||
else { /* non-32-bit time_t */
|
||||
tmp_time_t = host_stat->curtime.tv_sec;
|
||||
tmp_time = localtime(&tmp_time_t);
|
||||
host_time = *tmp_time;
|
||||
|
||||
host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec;
|
||||
|
||||
tmp_time_t = host_stat->curtime.tv_sec;
|
||||
tmp_time = gmtime(&tmp_time_t);
|
||||
host_uptime = *tmp_time;
|
||||
}
|
||||
|
||||
#define updays (host_stat->curtime.tv_sec / 86400)
|
||||
if (host_uptime.tm_yday != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user