From 99759626b3d6caa76c6f860601e231c3b58cdffd Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Tue, 17 Aug 2004 15:11:32 +0000 Subject: Calculate time_t correctly from (day, month, year): 1/1/70 is 0, not 1. ok deraadt@ --- sys/arch/i386/stand/libsa/time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/arch/i386/stand/libsa') diff --git a/sys/arch/i386/stand/libsa/time.c b/sys/arch/i386/stand/libsa/time.c index fe6096a7e6d..eca29d3c6ac 100644 --- a/sys/arch/i386/stand/libsa/time.c +++ b/sys/arch/i386/stand/libsa/time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: time.c,v 1.15 2004/03/09 19:12:13 tom Exp $ */ +/* $OpenBSD: time.c,v 1.16 2004/08/17 15:11:31 tom Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -61,7 +61,7 @@ compute(int year, u_int8_t month, u_int8_t day, u_int8_t hour, register time_t tt; /* Compute days */ - tt = (year - 1970) * 365 + monthcount[month] + day; + tt = (year - 1970) * 365 + monthcount[month] + day - 1; /* Compute for leap year */ for (month <= 2 ? year-- : 0; year >= 1970; year--) -- cgit v1.2.3