mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-12-25 01:31:51 +01:00
Moved RTC update function outside of draw procedure
Previous implementation caused increased drawing time when RTC datetime needed update every second
This commit is contained in:
parent
57dff16ec7
commit
65a7775964
@ -1,4 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <libdragon.h>
|
||||
|
||||
@ -162,6 +163,8 @@ void menu_run (boot_params_t *boot_params) {
|
||||
boot_pending = true;
|
||||
}
|
||||
}
|
||||
|
||||
time(&menu->current_time);
|
||||
}
|
||||
|
||||
while (audio_can_write()) {
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define MENU_STRUCT_H__
|
||||
|
||||
|
||||
#include <time.h>
|
||||
#include "boot/boot.h"
|
||||
#include "flashcart/flashcart.h"
|
||||
#include "path.h"
|
||||
@ -64,6 +65,8 @@ typedef struct {
|
||||
|
||||
char *error_message;
|
||||
|
||||
time_t current_time;
|
||||
|
||||
struct {
|
||||
bool go_up;
|
||||
bool go_down;
|
||||
|
@ -262,14 +262,12 @@ static void draw (menu_t *menu, surface_t *d) {
|
||||
menu->browser.entries == 0 ? "" : "R: Info"
|
||||
);
|
||||
|
||||
time_t current_time = time(NULL);
|
||||
|
||||
if (current_time >= 0) {
|
||||
if (menu->current_time >= 0) {
|
||||
component_actions_bar_text_draw(
|
||||
ALIGN_CENTER, VALIGN_TOP,
|
||||
"\n"
|
||||
"%s",
|
||||
ctime(¤t_time)
|
||||
ctime(&menu->current_time)
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user