diff packages/language/c/libc/current/include/time.inl @ 103:95f3e12a6327 ecos-sw-2000-06-23

Merge from eCos master repository on 2000-06-23-16:41:10-BST
author jlarmour
date Fri, 23 Jun 2000 17:06:31 +0000
parents bf00f99aec69
children
line wrap: on
line diff
--- a/packages/language/c/libc/current/include/time.inl
+++ b/packages/language/c/libc/current/include/time.inl
@@ -414,8 +414,7 @@ CYGPRI_LIBC_TIME_GMTIME_R_INLINE struct 
     // Day of the year. We know _tim is +ve now
     CYG_ASSERT(_tim >= 0,
                "Number of seconds since start of year is negative!");
-    // assign tm_mday as well for further below
-    __result->tm_mday = __result->tm_yday = _tim / CYGNUM_LIBC_TIME_SECSPERDAY;
+    __result->tm_yday = _tim / CYGNUM_LIBC_TIME_SECSPERDAY;
 
     // Day of the week. Normalize to be 0..6, and note that it might
     // be negative, so we have to deal with the modulus being
@@ -425,7 +424,9 @@ CYGPRI_LIBC_TIME_GMTIME_R_INLINE struct 
     // Month and Day of the month
 
     _months_p = cyg_libc_time_month_lengths[
-        cyg_libc_time_year_is_leap(1900 + __result->tm_year)];
+        cyg_libc_time_year_is_leap(1900 + __result->tm_year) ? 1 : 0 ];
+
+    __result->tm_mday = __result->tm_yday+1;
 
     for (__result->tm_mon = 0;
          __result->tm_mday > _months_p[__result->tm_mon];
@@ -435,10 +436,6 @@ CYGPRI_LIBC_TIME_GMTIME_R_INLINE struct 
 
     } // for
 
-    // The month day is now in the range 0..30
-    // We move it to 1..31
-    ++__result->tm_mday;
-    
     _tim -= __result->tm_yday*CYGNUM_LIBC_TIME_SECSPERDAY;
 
     // hours, mins secs