commit a0c384b
Devine Lu Linvega
·
2026-02-11 16:36:34 +0000 UTC
parent df88c08
Limit datetime syscall
1 files changed,
+11,
-7
+11,
-7
1@@ -544,8 +544,7 @@ screen_deo_sprite(void)
2 Uint8 *d = dst;
3 const int ch1 = *col, ch2 = is_2bpp ? col[8] : 0;
4 for(int k = 0, row = row_start; k < 8; k++, d++, row += row_delta) {
5- const int bit = 1 << row;
6- const int color = !!(ch1 & bit) | (!!(ch2 & bit) << 1);
7+ const int color = ((ch1 >> row) & 1) | (((ch2 >> row) & 1) << 1);
8 if(opaque_mask || color)
9 *d = (*d & layer_mask) | table[color];
10 }
11@@ -911,16 +910,20 @@ static void fileb_deo_write(void) { poke2(&uxn.dev[0xb2], file_write(1, peek2(&u
12
13 #include <time.h>
14
15+int datetime_busy;
16 time_t datetime_seconds;
17 struct tm *datetime_t, datetime_zt = {0};
18
19 void
20 datetime_update(void)
21 {
22- datetime_seconds = time(NULL);
23- datetime_t = localtime(&datetime_seconds);
24- if(datetime_t == NULL)
25- datetime_t = &datetime_zt;
26+ if(!datetime_busy) {
27+ datetime_seconds = time(NULL);
28+ datetime_t = localtime(&datetime_seconds);
29+ if(datetime_t == NULL)
30+ datetime_t = &datetime_zt;
31+ datetime_busy = 1;
32+ }
33 }
34
35 /* clang-format off */
36@@ -1292,6 +1295,7 @@ emu_run(void)
37 stdin_active = 0;
38 }
39 }
40+ datetime_busy = 0;
41 }
42 if(emu_timer >= 0)
43 close(emu_timer);
44@@ -1307,7 +1311,7 @@ main(int argc, char **argv)
45 {
46 int i = 1;
47 if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'v')
48- return !fprintf(stdout, "%s - Varvara Emulator, 8 Feb 2026.\n", argv[0]);
49+ return !fprintf(stdout, "%s - Varvara Emulator, 11 Feb 2026.\n", argv[0]);
50 else if(argc == 1)
51 return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]);
52 else if(!system_boot(argv[i++], argc > 2))