From e93d50ef3bbcc0974e7290d6bee3abc58e29cfcc Mon Sep 17 00:00:00 2001 From: bde Date: Mon, 29 Jun 1998 17:25:46 +0000 Subject: Don't assume that time_t is long. --- usr.bin/doscmd/bios.c | 6 ++++-- usr.bin/doscmd/int1a.c | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/doscmd/bios.c b/usr.bin/doscmd/bios.c index 4cad864..ccfdce8 100644 --- a/usr.bin/doscmd/bios.c +++ b/usr.bin/doscmd/bios.c @@ -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; diff --git a/usr.bin/doscmd/int1a.c b/usr.bin/doscmd/int1a.c index a75dfec..7a97330 100644 --- a/usr.bin/doscmd/int1a.c +++ b/usr.bin/doscmd/int1a.c @@ -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); -- cgit v1.1