Don't assume that time_t is long.

This commit is contained in:
bde 1998-06-29 17:25:46 +00:00
parent 122886a1e0
commit e93d50ef3b
3 changed files with 20 additions and 10 deletions

View File

@ -29,7 +29,7 @@
*
* BSDI bios.c,v 2.3 1996/04/08 19:32:19 bostic Exp
*
* $Id: bios.c,v 1.1 1997/08/09 01:42:33 dyson Exp $
* $Id: bios.c,v 1.2 1997/08/15 23:41:23 jlemon Exp $
*/
#include "doscmd.h"
@ -168,6 +168,7 @@ bios_init(void)
int i, j, k;
u_char *jtab;
struct timeval tv;
time_t tv_sec;
struct timezone tz;
struct tm tm;
u_long vec;
@ -295,7 +296,8 @@ bios_init(void)
}
gettimeofday(&tv, &tz);
tm = *localtime(&tv.tv_sec);
tv_sec = tv.tv_sec;
tm = *localtime(&tv_sec);
*(u_long *)&BIOSDATA[0x6c] =
(((tm.tm_hour * 60 + tm.tm_min) * 60) + tm.tm_sec) * 182 / 10;

View File

@ -29,7 +29,7 @@
*
* BSDI int1a.c,v 2.2 1996/04/08 19:32:49 bostic Exp
*
* $Id: int1a.c,v 1.3 1996/09/22 15:42:56 miff Exp $
* $Id: int1a.c,v 1.1 1997/08/09 01:42:49 dyson Exp $
*/
#include "doscmd.h"
@ -47,6 +47,7 @@ int1a(regcontext_t *REGS)
struct timeval tod;
struct timezone zone;
struct tm *tm;
time_t tv_sec;
long value;
static long midnight = 0;
@ -57,7 +58,8 @@ int1a(regcontext_t *REGS)
gettimeofday(&tod, &zone);
if (midnight == 0) {
tm = localtime(&boot_time.tv_sec);
tv_sec = boot_time.tv_sec;
tm = localtime(&tv_sec);
midnight = boot_time.tv_sec - (((tm->tm_hour * 60)
+ tm->tm_min) * 60
+ tm->tm_sec);
@ -66,7 +68,8 @@ int1a(regcontext_t *REGS)
R_AL = (tod.tv_sec - midnight) / (24 * 60 * 60);
if (R_AL) {
tm = localtime(&boot_time.tv_sec);
tv_sec = boot_time.tv_sec;
tm = localtime(&tv_sec);
midnight = boot_time.tv_sec - (((tm->tm_hour * 60)
+ tm->tm_min) * 60
+ tm->tm_sec);
@ -81,14 +84,16 @@ int1a(regcontext_t *REGS)
break;
case 0x01: /* set current clock count */
tm = localtime(&boot_time.tv_sec);
tv_sec = boot_time.tv_sec;
tm = localtime(&tv_sec);
midnight = boot_time.tv_sec - (((tm->tm_hour * 60)
+ tm->tm_min) * 60 + tm->tm_sec);
break;
case 0x02:
gettimeofday(&tod, &zone);
tm = localtime(&tod.tv_sec);
tv_sec = tod.tv_sec;
tm = localtime(&tv_sec);
R_CH = to_BCD(tm->tm_hour);
R_CL = to_BCD(tm->tm_min);
R_DH = to_BCD(tm->tm_sec);
@ -96,7 +101,8 @@ int1a(regcontext_t *REGS)
case 0x04:
gettimeofday(&tod, &zone);
tm = localtime(&tod.tv_sec);
tv_sec = tod.tv_sec;
tm = localtime(&tv_sec);
R_CH = to_BCD((tm->tm_year + 1900) / 100);
R_CL = to_BCD((tm->tm_year + 1900) % 100);
R_DH = to_BCD(tm->tm_mon + 1);

View File

@ -37,7 +37,7 @@
*
* @(#)amq_subr.c 8.1 (Berkeley) 6/6/93
*
* $Id$
* $Id: amq_subr.c,v 1.3 1997/02/22 16:01:27 peter Exp $
*
*/
/*
@ -283,6 +283,7 @@ xdr_amq_mount_tree_node(xdrs, objp)
amq_mount_tree *objp;
{
am_node *mp = (am_node *) objp;
long mtime;
if (!xdr_amq_string(xdrs, &mp->am_mnt->mf_info)) {
return (FALSE);
@ -296,7 +297,8 @@ xdr_amq_mount_tree_node(xdrs, objp)
if (!xdr_amq_string(xdrs, &mp->am_mnt->mf_ops->fs_type)) {
return (FALSE);
}
if (!xdr_long(xdrs, &mp->am_stats.s_mtime)) {
mtime = mp->am_stats.s_mtime;
if (!xdr_long(xdrs, &mtime)) {
return (FALSE);
}
if (!xdr_u_short(xdrs, &mp->am_stats.s_uid)) {