This commit is contained in:
rumbledethumps
2025-12-06 11:38:27 -08:00
parent 18f084eafb
commit 328f7e6a43
7 changed files with 51 additions and 59 deletions

View File

@@ -5,9 +5,9 @@
;
.export _localtime
.import __time_t_to_tm, __tz, _tzset_time
.import __time_t_to_tm, __tz
.import ldeaxi, tosaddeax, pusheax
.importzp sreg, ptr1
.importzp sreg
_localtime:
cpx #$00 ; Check for null pointer
@@ -16,7 +16,6 @@ _localtime:
beq no_pointer
: jsr ldeaxi ; Load value
jsr pusheax ; Push it
jsr _tzset_time
lda __tz+1+3
sta sreg+1
lda __tz+1+2
@@ -24,13 +23,7 @@ _localtime:
ldx __tz+1+1
lda __tz+1
jsr tosaddeax ; Add _tz.timezone
jsr __time_t_to_tm ; Convert to struct tm
sta ptr1 ; Returned tm pointer
stx ptr1+1
ldy #16
lda __tz+0 ; Load _tz.daylight
sta (ptr1),y ; Store to tm.tm_isdst
lda ptr1
jmp __time_t_to_tm ; Convert to struct tm
no_pointer:
rts ; A/X already set