code cleaning, // comments replaced with /* */
[fw/sdcc] / device / lib / time.c
index 0df576704641a15c5d616bbd5855f0de93acc91c..5d6f45fed8bf1882fa20c8a3ba609a0251af897f 100755 (executable)
@@ -25,8 +25,6 @@
 #include <stdio.h>
 #include <time.h>
 
-#define FIXDS390BUG (long)
-
 // please note that the tm structure has the years since 1900,
 // but time returns the seconds since 1970
 
@@ -60,10 +58,10 @@ time_t time(time_t *timeptr) {
 
 static _CODE char monthDays[]={31,28,31,30,31,30,31,31,30,31,30,31};
 
-static _CODE char *month[]={"Jan","Feb","Mar","Apr","May","Jun",
-                "Jul","Aug","Sep","Oct","Nov","Dec"};
+_CODE char * _CODE __month[]={"Jan","Feb","Mar","Apr","May","Jun",
+                             "Jul","Aug","Sep","Oct","Nov","Dec"};
 
-static _CODE char *day[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
+_CODE char * _CODE __day[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
 
 static char ascTimeBuffer[32];
 
@@ -90,7 +88,7 @@ static void CheckTime(struct tm *timeptr) {
 char *asctime(struct tm *timeptr) {
   CheckTime(timeptr);
   sprintf (ascTimeBuffer, "%s %s %2d %02d:%02d:%02d %04d\n",
-          day[timeptr->tm_wday], month[timeptr->tm_mon], timeptr->tm_mday,
+          __day[timeptr->tm_wday], __month[timeptr->tm_mon], timeptr->tm_mday,
           timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec, 
           timeptr->tm_year+1900);
   return ascTimeBuffer;
@@ -178,28 +176,28 @@ time_t mktime(struct tm *timeptr) {
     CheckTime(timeptr);
 
     // seconds from 1970 till 1 jan 00:00:00 this year
-    seconds= FIXDS390BUG (year-1970)*60*60*24*365;
+    seconds= (year-1970)*60*60*24*365;
 
     // add extra days for leap years
     for (i=1970; i<year; i++) {
        if (LEAP_YEAR(i)) {
-           seconds+= FIXDS390BUG 60*60*24;
+           seconds+= 60*60*24;
        }
     }
 
     // add days for this year
     for (i=0; i<month; i++) {
       if (i==1 && LEAP_YEAR(year)) { 
-       seconds+= FIXDS390BUG 60*60*24*29;
+       seconds+= 60*60*24*29;
       } else {
-       seconds+= FIXDS390BUG 60*60*24*monthDays[i];
+       seconds+= 60*60*24*monthDays[i];
       }
     }
 
-    seconds+= FIXDS390BUG (timeptr->tm_mday-1)*60*60*24;
-    seconds+= FIXDS390BUG timeptr->tm_hour*60*60;
-    seconds+= FIXDS390BUG timeptr->tm_min*60;
-    seconds+= FIXDS390BUG timeptr->tm_sec;
+    seconds+= timeptr->tm_mday-1*60*60*24;
+    seconds+= timeptr->tm_hour*60*60;
+    seconds+= timeptr->tm_min*60;
+    seconds+= timeptr->tm_sec;
     return seconds;
 }