Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 64Bit_time_t.diff
- Make Native Targets Date functionalty (hopefully) Year 2038+ Capable :-)
- (only Change was the time.h: time_t as long long, the otp plugin is untestet)
- As the (unsigned !) RTC Hardware Counter (per def.) starts at 0 in 1970
- it should be safe before 2104... (Than the 32Bit Counter rolls over)
- Testet/used on Devices with a 32Bit RTC Counter as Hardware Clock
- (AS3514 based Sansa e200,ClipZip,Fuze, 4760b X3, x1000 native Fiio m3k, ErosQ)
- I could set a Date after 2038 in the og Players, and after Powercycle,
- it was remembered...
- Test with Date 24.08.2093: Screendump has the Filename 'dump 930824-161026.bmp'
- and FileInfo 2093/08/24 in Rockbox Menue and FileInfo on Linux (SDCard Mounted)
- (RB Config Files config... nvram... :Fileinfo 2093/08/24...)
- (needs way more Smoketesting before the Year 2038 Apocalypse...)
- Mini-Credit ZappBranigan2972 on forums / F. Jacobsen on the Theme Site
- ---
- --- a/firmware/libc/include/time.h.orig 2023-12-31 10:51:38.079765097 +0100
- +++ b/firmware/libc/include/time.h 2023-12-31 09:37:11.293918321 +0100
- @@ -26,7 +26,7 @@
- };
- #if !defined(_TIME_T_DEFINED) && !defined(_TIME_T_DECLARED)
- -typedef long time_t;
- +typedef long long time_t;
- /* this define below is used by the mingw headers to prevent duplicate
- typedefs */
- --- a/apps/plugins/otp.c.orig 2023-12-31 10:53:52.767339434 +0100
- +++ b/apps/plugins/otp.c 2023-12-31 09:37:56.225209097 +0100
- @@ -44,7 +44,7 @@
- union {
- uint64_t hotp_counter;
- - int totp_period;
- + uint64_t totp_period;
- };
- int digits;
- @@ -528,7 +528,7 @@
- #if CONFIG_RTC
- else
- {
- - rb->splashf(0, "%0*d (%ld seconds(s) left)", accounts[acct].digits,
- + rb->splashf(0, "%0*d (%lld seconds(s) left)", accounts[acct].digits,
- TOTP(accounts[acct].secret,
- accounts[acct].sec_len,
- accounts[acct].totp_period,
- @@ -693,7 +693,7 @@
- if(accounts[acct].is_totp)
- rb->snprintf(data_buf, sizeof(data_buf), "%d", (int)accounts[acct].hotp_counter);
- else
- - rb->snprintf(data_buf, sizeof(data_buf), "%d", accounts[acct].totp_period);
- + rb->snprintf(data_buf, sizeof(data_buf), "%lld", accounts[acct].totp_period);
- if(rb->kbd_input(data_buf, sizeof(data_buf), NULL) < 0)
- break;
Advertisement
Add Comment
Please, Sign In to add comment