Skip to content

Commit

Permalink
Remove localtime() uses, saving ~4-28KB from the final binary size.
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed May 23, 2021
1 parent a1859e4 commit 2502dbe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arm9/source/emulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ void
datetime_talk(Device *d, Uint8 b0, Uint8 w)
{
time_t seconds = time(NULL);
struct tm *t = localtime(&seconds);
struct tm *t = gmtime(&seconds);
t->tm_year += 1900;
mempoke16(d->dat, 0x0, t->tm_year);
d->dat[0x2] = t->tm_mon;
Expand Down
20 changes: 20 additions & 0 deletions arm9/source/stubs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <nds.h>
#include <time.h>

// Stubbing out unused functionality, in order to optimize the uxnds filesize.

// libfat source/filetime.c

uint16_t _FAT_filetime_getTimeFromRTC (void) {
return 0;
}

uint16_t _FAT_filetime_getDateFromRTC (void) {
return 0;

}
time_t _FAT_filetime_to_time_t (uint16_t t, uint16_t d) {
return 0;
}


0 comments on commit 2502dbe

Please sign in to comment.