Revert "simpletime refactor away 28 bytes"
This reverts commit c4c67865e8
.
This commit is contained in:
parent
5256464953
commit
35c73e6266
|
@ -4,8 +4,9 @@
|
|||
|
||||
time_t _timet=0;
|
||||
|
||||
char _ytab[12] = {
|
||||
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
||||
int _ytab[2][12] = {
|
||||
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
|
||||
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
||||
};
|
||||
|
||||
struct tm * mygmtime(register const time_t time) {
|
||||
|
@ -13,7 +14,6 @@ struct tm * mygmtime(register const time_t time) {
|
|||
register struct tm *timep = &br_time;
|
||||
register unsigned long dayclock, dayno;
|
||||
int year = EPOCH_YR;
|
||||
int month_days;
|
||||
|
||||
dayclock = (unsigned long)time % SECS_DAY;
|
||||
dayno = (unsigned long)time / SECS_DAY;
|
||||
|
@ -29,10 +29,9 @@ struct tm * mygmtime(register const time_t time) {
|
|||
timep->tm_year = year - YEAR0;
|
||||
timep->tm_yday = dayno;
|
||||
timep->tm_mon = 0;
|
||||
while (dayno >= (month_days = _ytab[timep->tm_mon] +
|
||||
(LEAPYEAR (year) && timep->tm_mon==2)?1:0)) {
|
||||
dayno -= month_days;
|
||||
timep->tm_mon++;
|
||||
while (dayno >= _ytab[LEAPYEAR(year)][timep->tm_mon]) {
|
||||
dayno -= _ytab[LEAPYEAR(year)][timep->tm_mon];
|
||||
timep->tm_mon++;
|
||||
}
|
||||
timep->tm_mday = dayno + 1;
|
||||
timep->tm_isdst = 0;
|
||||
|
|
Loading…
Reference in New Issue