[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-commit] [2337] Fixed an error computing the fractional day.
From: |
Mike Rice |
Subject: |
[avr-libc-commit] [2337] Fixed an error computing the fractional day. |
Date: |
Sun, 07 Apr 2013 16:11:19 +0000 |
Revision: 2337
http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2337
Author: swfltek
Date: 2013-04-07 16:11:19 +0000 (Sun, 07 Apr 2013)
Log Message:
-----------
Fixed an error computing the fractional day.
Modified Paths:
--------------
trunk/avr-libc/libc/time/mk_gmtime.c
Modified: trunk/avr-libc/libc/time/mk_gmtime.c
===================================================================
--- trunk/avr-libc/libc/time/mk_gmtime.c 2013-04-07 16:09:23 UTC (rev
2336)
+++ trunk/avr-libc/libc/time/mk_gmtime.c 2013-04-07 16:11:19 UTC (rev
2337)
@@ -40,7 +40,7 @@
{
time_t ret;
- long tmp;
+ uint32_t tmp;
int n, m, d, leaps;
/*
@@ -54,7 +54,7 @@
leaps -= m / 100;
leaps++;
}
- tmp = 365L * n + leaps;
+ tmp = 365UL * n + leaps;
/*
Derive the day of year from month and day of month
@@ -86,13 +86,14 @@
/* Add day of year to elapsed days, and convert to seconds */
tmp += d;
- ret = ONE_DAY * tmp;
+ tmp *= ONE_DAY;
+ ret = tmp;
/* compute 'fractional' day */
- tmp = ONE_HOUR * timeptr->tm_hour;
- tmp += 60L * timeptr->tm_min;
+ tmp = timeptr->tm_hour;
+ tmp *= ONE_HOUR;
+ tmp += timeptr->tm_min * 60UL;
tmp += timeptr->tm_sec;
-
ret += tmp;
return ret;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-commit] [2337] Fixed an error computing the fractional day.,
Mike Rice <=