avr-libc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-commit] [2328] Simplified month_length() somewhat


From: Mike Rice
Subject: [avr-libc-commit] [2328] Simplified month_length() somewhat
Date: Tue, 02 Apr 2013 21:27:24 +0000

Revision: 2328
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2328
Author:   swfltek
Date:     2013-04-02 21:27:23 +0000 (Tue, 02 Apr 2013)
Log Message:
-----------
Simplified month_length() somewhat

Modified Paths:
--------------
    trunk/avr-libc/libc/time/month_length.c

Modified: trunk/avr-libc/libc/time/month_length.c
===================================================================
--- trunk/avr-libc/libc/time/month_length.c     2013-04-02 21:26:33 UTC (rev 
2327)
+++ trunk/avr-libc/libc/time/month_length.c     2013-04-02 21:27:23 UTC (rev 
2328)
@@ -29,8 +29,8 @@
 /* $Id$ */
 
 /*
-       Return the length of a month in days, given the year and month in 
question.
-       The month parameter must be '1 based', ranging from 1 to 12.
+    Return the length of a month in days, given the year and month in question.
+    The month parameter must be '1 based', ranging from 1 to 12.
 */
 
 #include <time.h>
@@ -38,14 +38,7 @@
 char
 month_length(int year, char month)
 {
-       char            ret;
-
-       if (month == 2) {
-               ret = 28;
-               if (is_leap_year(year))
-                       ret++;
-       } else {
-               ret = 30 + ((month + month / 8) & 1);
-       }
-       return ret;
+    if (month == 2) return 28 + is_leap_year(year);
+        
+    return 30 + ((month + month / 8) & 1);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]