Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 1106 invoked from network); 29 Aug 2009 07:38:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Aug 2009 07:38:12 -0000 Received: (qmail 6301 invoked by uid 500); 29 Aug 2009 07:38:11 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 6228 invoked by uid 500); 29 Aug 2009 07:38:11 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 6219 invoked by uid 99); 29 Aug 2009 07:38:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Aug 2009 07:38:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Aug 2009 07:38:09 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 73E3F23888E9; Sat, 29 Aug 2009 07:37:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r809090 - /commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c Date: Sat, 29 Aug 2009 07:37:49 -0000 To: commits@commons.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090829073749.73E3F23888E9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mturk Date: Sat Aug 29 07:37:49 2009 New Revision: 809090 URL: http://svn.apache.org/viewvc?rev=809090&view=rev Log: Use struct tm instead APR expanded time Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c?rev=809090&r1=809089&r2=809090&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c Sat Aug 29 07:37:49 2009 @@ -52,7 +52,7 @@ return days * ACR_USEC_PER_SEC; } -static void SystemTimeToAprExpTime(struct tm *tm, SYSTEMTIME *st) +static void SystemTimeToTmTime(struct tm *tm, SYSTEMTIME *st) { static const int dayoffset[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; @@ -90,18 +90,17 @@ ACR_DECLARE(acr_time_t) ACR_Dos2AcrTime(acr_uint32_t t) { - acr_tm_t xt; + struct tm tm; acr_uint32_t ud = (t >> 16); - xt.tm_mday = ud & 0x1F; - xt.tm_mon = (acr_uint32_t)(((ud & 0x01E0) / 0x0020) - 1); - xt.tm_year = (acr_uint32_t)(((ud & 0xFE00) / 0x0200) + 80); - xt.tm_hour = (acr_uint32_t)((t & 0xF800) / 0x0800); - xt.tm_min = (acr_uint32_t)((t & 0x07E0) / 0x0020); - xt.tm_sec = (acr_uint32_t)((t & 0x001F) << 1); - xt.tm_usec = 0; + tm.tm_mday = ud & 0x1F; + tm.tm_mon = (acr_uint32_t)(((ud & 0x01E0) / 0x0020) - 1); + tm.tm_year = (acr_uint32_t)(((ud & 0xFE00) / 0x0200) + 80); + tm.tm_hour = (acr_uint32_t)((t & 0xF800) / 0x0800); + tm.tm_min = (acr_uint32_t)((t & 0x07E0) / 0x0020); + tm.tm_sec = (acr_uint32_t)((t & 0x001F) << 1); - return tm2time(&xt); + return tm2time(&tm); } ACR_DECLARE(acr_uint32_t) ACR_Acr2DosTime(acr_time_t t) @@ -116,7 +115,7 @@ /* The Platform SDK documents that SYSTEMTIME/FILETIME are * generally UTC, so no timezone info needed */ - SystemTimeToAprExpTime(tm, &st); + SystemTimeToTmTime(&tm, &st); if (tm.tm_year > 1980) tm.tm_year -= 1980; else if (tm.tm_year > 80)