-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mktime() to LIBC and bump release to v3.09-9
- Loading branch information
Showing
18 changed files
with
137 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
c | ||
<-c -o start1.as open.c read.c write.c chmod.c seek.c \ | ||
<fcbname.c rename.c creat.c time.c convtime.c timezone.c \ | ||
<stat.c isatty.c cleanup.c close.c unlink.c dup.c getfcb.c \ | ||
<srand1.c getch.c signal.c getuid.as abort.c execl.as bdos.as \ | ||
<bios.as _exit.as exit.as fakeclea.as fakecpcl.as sys_err.c | ||
c | ||
<-c -o start1.as open.c read.c write.c chmod.c seek.c \ | ||
<fcbname.c rename.c creat.c time.c convtime.c timezone.c \ | ||
<stat.c isatty.c cleanup.c close.c unlink.c dup.c getfcb.c \ | ||
<srand1.c getch.c signal.c getuid.as abort.c execl.as bdos.as \ | ||
<bios.as _exit.as exit.as fakeclea.as fakecpcl.as sys_err.c \ | ||
<mktime.c | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* Convert structure to time value */ | ||
|
||
#include <time.h> | ||
|
||
/* leap year calculator expects year argument as years offset from 1900 */ | ||
#define LEAP_YEAR(Y) ( ((1900+(Y))>0) && !((1900+(Y))%4) && ( ((1900+(Y))%100) || !((1900+(Y))%400) ) ) | ||
|
||
#define SECS_PER_DAY (86400l) | ||
#define SECS_PER_HOUR (3600l) | ||
#define SECS_PER_MIN (60l) | ||
|
||
static unsigned char monthDays[]={31,28,31,30,31,30,31,31,30,31,30,31}; | ||
|
||
time_t mktime(struct tm *ptm){ | ||
|
||
int i; | ||
time_t seconds; | ||
|
||
/* seconds from 1970 till 1 jan 00:00:00 of the given year */ | ||
seconds= (ptm->tm_year-70)*(SECS_PER_DAY * 365); | ||
for (i = 70; i < ptm->tm_year; i++) { | ||
if (LEAP_YEAR(i)) { | ||
seconds += SECS_PER_DAY; /* add extra days for leap years */ | ||
} | ||
} | ||
|
||
/* add days for this year */ | ||
for (i = 0; i < ptm->tm_mon; i++) { | ||
if ( (i == 1) && LEAP_YEAR(ptm->tm_year)) { | ||
seconds += SECS_PER_DAY * 29; | ||
} else { | ||
seconds += SECS_PER_DAY * (int)monthDays[i]; | ||
} | ||
} | ||
seconds += (ptm->tm_mday-1) * SECS_PER_DAY; | ||
seconds += ptm->tm_hour * SECS_PER_HOUR; | ||
seconds += ptm->tm_min * SECS_PER_MIN; | ||
seconds += ptm->tm_sec; | ||
seconds += time_zone * SECS_PER_MIN; | ||
return (time_t)seconds; | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,7 @@ c280 | |
<memcmp.c \ | ||
<memcpy.c \ | ||
<memset.c \ | ||
<mods.txt \ | ||
<mktime.c \ | ||
<open.c \ | ||
<perror.c \ | ||
<pnum.c \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.