From ea024283b0e23158d8bb9eb098d9a10e55903d20 Mon Sep 17 00:00:00 2001 From: jmmv Date: Mon, 17 Jan 2011 22:21:25 +0000 Subject: [PATCH] Fix year correction in platform_add_date so that: * Years in the [90,99] range are considered to be in 1900. * Years in the [0,89] range are considered to be in 2000. This makes my MacBookPro2,2 be recognized as from 2007 instead of 1907, which in turn lets ACPI (and many other things!) work. Fix proposed by jmcneill@ as an alternative to my workaround in acpi_quirks.c sent to port-i386@. --- sys/arch/x86/x86/platform.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/arch/x86/x86/platform.c b/sys/arch/x86/x86/platform.c index db162439b565..5f9c9ec3da77 100644 --- a/sys/arch/x86/x86/platform.c +++ b/sys/arch/x86/x86/platform.c @@ -1,4 +1,4 @@ -/* $NetBSD: platform.c,v 1.9 2010/09/06 15:54:27 jmcneill Exp $ */ +/* $NetBSD: platform.c,v 1.10 2011/01/17 22:21:25 jmmv Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -29,7 +29,7 @@ #include "isa.h" #include -__KERNEL_RCSID(0, "$NetBSD: platform.c,v 1.9 2010/09/06 15:54:27 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: platform.c,v 1.10 2011/01/17 22:21:25 jmmv Exp $"); #include #include @@ -165,10 +165,12 @@ platform_add_date(struct smbtable *tbl, const char *key, int idx) return; if (month == 0 || month > 12 || day == 0 || day > 31) return; - if (year < 100) - year += 1900; if (year > 9999) return; + if (year < 90) + year += 2000; + else if (year < 100) + year += 1900; sprintf(datestr, "%04u%02u%02u", year, month, day); pmf_set_platform(key, datestr); }