From: Bradley D. L. <br...@us...> - 2001-09-07 18:21:57
|
Update of /cvsroot/linux-mips/linux/arch/mips/kernel In directory usw-pr-cvs1:/tmp/cvs-serv16247/arch/mips/kernel Modified Files: gdb-stub.c time.c Log Message: Eliminate some mostly (except for time.c) diffs against oss. Index: gdb-stub.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/kernel/gdb-stub.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gdb-stub.c 2001/07/09 19:28:47 1.2 --- gdb-stub.c 2001/09/07 18:21:54 1.3 *************** *** 12,17 **** * * Copyright (C) 1995 Andreas Busse - * - * $Id$ */ --- 12,15 ---- Index: time.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/kernel/time.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** time.c 2001/08/25 02:19:27 1.7 --- time.c 2001/09/07 18:21:54 1.8 *************** *** 3,7 **** * Author: Jun Sun, js...@mv... or js...@ju... * ! * Common time service routines for MIPS machines. See Documents/MIPS/time.txt. * * This program is free software; you can redistribute it and/or modify it --- 3,8 ---- * Author: Jun Sun, js...@mv... or js...@ju... * ! * Common time service routines for MIPS machines. See ! * Documents/MIPS/README.txt. * * This program is free software; you can redistribute it and/or modify it *************** *** 461,510 **** } ! /* ================================================== */ ! #define FEBRUARY 2 ! #define STARTOFTIME 1970 ! #define SECDAY 86400L ! #define SECYR (SECDAY * 365) ! #define leapyear(year) ((year) % 4 == 0) ! #define days_in_year(a) (leapyear(a) ? 366 : 365) ! #define days_in_month(a) (month_days[(a) - 1]) static int month_days[12] = { ! 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; void to_tm(unsigned long tim, struct rtc_time * tm) { ! register int i; ! register long hms, day; ! day = tim / SECDAY; ! hms = tim % SECDAY; ! /* Hours, minutes, seconds are easy */ ! tm->tm_hour = hms / 3600; ! tm->tm_min = (hms % 3600) / 60; ! tm->tm_sec = (hms % 3600) % 60; ! /* Number of years in days */ ! for (i = STARTOFTIME; day >= days_in_year(i); i++) ! day -= days_in_year(i); ! tm->tm_year = i; ! /* Number of months in days left */ ! if (leapyear(tm->tm_year)) ! days_in_month(FEBRUARY) = 29; ! for (i = 1; day >= days_in_month(i); i++) ! day -= days_in_month(i); ! days_in_month(FEBRUARY) = 28; ! tm->tm_mon = i; ! /* Days are what is left over (+1) from all that. */ ! tm->tm_mday = day + 1; ! /* ! * Determine the day of week ! */ ! tm->tm_wday = (day + 3) % 7; } - --- 462,509 ---- } ! #define FEBRUARY 2 ! #define STARTOFTIME 1970 ! #define SECDAY 86400L ! #define SECYR (SECDAY * 365) ! #define leapyear(year) ((year) % 4 == 0) ! #define days_in_year(a) (leapyear(a) ? 366 : 365) ! #define days_in_month(a) (month_days[(a) - 1]) static int month_days[12] = { ! 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; void to_tm(unsigned long tim, struct rtc_time * tm) { ! long hms, day, gday; ! int i; ! gday = day = tim / SECDAY; ! hms = tim % SECDAY; ! /* Hours, minutes, seconds are easy */ ! tm->tm_hour = hms / 3600; ! tm->tm_min = (hms % 3600) / 60; ! tm->tm_sec = (hms % 3600) % 60; ! /* Number of years in days */ ! for (i = STARTOFTIME; day >= days_in_year(i); i++) ! day -= days_in_year(i); ! tm->tm_year = i; ! /* Number of months in days left */ ! if (leapyear(tm->tm_year)) ! days_in_month(FEBRUARY) = 29; ! for (i = 1; day >= days_in_month(i); i++) ! day -= days_in_month(i); ! days_in_month(FEBRUARY) = 28; ! tm->tm_mon = i; ! /* Days are what is left over (+1) from all that. */ ! tm->tm_mday = day + 1; ! /* ! * Determine the day of week ! */ ! tm->tm_wday = (gday + 4) % 7; /* 1970/1/1 was Thursday */ } |