OK, turing.

<- leave blank

Fri Dec 6 13:57:46 EST 2019

diff -r 77938288732a sys/src/cmd/seconds.c
--- a/sys/src/cmd/seconds.c Thu Dec 05 00:16:15 2019 -0800
+++ b/sys/src/cmd/seconds.c Fri Dec 06 10:57:45 2019 -0800
@@ -102,8 +102,6 @@
 {
	int i, mer = HR24, bigval = -1;
	long flg = 0, ty;
- char *p;
- char upzone[32];
	Datetok *tp;

	now = localtime(time(0)); /* default to local time (zone) */
@@ -143,13 +141,9 @@
			break;
		case Dtz:
		case Tz:
+ /* tm2sec mangles timezones, so we do our own handling */
			tm->tzoff = FROMVAL(tp);
- /* tm2sec needs the name in upper case */
- strcpy(upzone, fields[i]);
- for (p = upzone; *p; p++)
- if (isascii(*p) && islower(*p))
- *p = toupper(*p);
- strncpy(tm->zone, upzone, sizeof tm->zone);
+ snprint(tm->zone, sizeof(tm->zone), "GMT");
			break;
		case Ignore:
			break;
@@ -216,7 +210,7 @@
	memset(&date, 0, sizeof date);
	if (prsabsdate(timestr, localtime(time(0)), &date) < 0)
		return -1;
- return validtm(&date)?  tm2sec(&date): -1;
+ return validtm(&date)?  tm2sec(&date) - 60*date.tzoff: -1;
 }

 int


Fri Dec 6 07:33:59 EST 2019
iukjm

Thu Dec 5 16:47:40 EST 2019
ok, turing.

Thu Dec 5 12:59:55 EST 2019
.equ USICR, 0x0D ; USI Control Register
.equ USISR, 0x0E ; USI Status Register
.equ USIDR, 0x0F ; USI Data Register
.equ USIBR, 0x10 ; USI Buffer Register
.equ PCMSK, 0x15 ; Pin Change MaSK register
.equ PINB, 0x16 ; PIN B values
.equ DDRB, 0x17 ; Data Direction Register B
.equ PORTB, 0x18 ; PORT B
.equ OCR0A, 0x29 ; Output Compare Register 0A
.equ TCCR0A, 0x2A ; Timer/Counter Control Register 0A
.equ GTCCR, 0x2C ; General Timer/Counter Control Register
.equ OSCCAL, 0x31 ; OSCillator CALibration register
.equ TCNT0, 0x32 ; Timer/ CouNTer register
.equ TCCR0B, 0x33 ; Timer/Counter Control Register 0B
.equ TIFR, 0x38 ; Timer/counter Interrupt Flag Register
.equ TIMSK, 0x39 ; Timer/counter Interrupt Mask register
.equ GIMSK, 0x3B ; General Interrupt MaSK register
.equ SPL, 0x3D ; Stack Pointer Low byte
.equ SPH, 0x3E ; Stack Pointer High byte
.equ SREG, 0x3F ; Status REGister

.macro initstack
	ldi r16, lo8(RAMEND) ; setup stack
	out SPL, r16
	ldi r16, hi8(RAMEND)
	out SPH, r16
.endm
; initialization routines, take no input produce no output, but may use any
registers they wish
.include "defs.h"

.section .text
.globl initstack
.globl initdata

; void -- void
initdata:
	ldi r17, sizeofdata ; load .data segment
	ldi r28, lo8(_data)
	ldi r29, hi8(_data)
	ldi r30, lo8(dataload)
	ldi r31, hi8(dataload)
load:
	lpm r16, Z+
	st Y+, r16
	dec r17
	brne load
	ret
; lever lifecycle tester program for ATTiny85
.include "defs.h"

; Pin assignment
.equ PINLEFT, 0
.equ PINRIGHT, 1
; time in 0.1 s increments.
.equ TIMELEFT, 12
.equ TIMEWAIT, 5
.equ TIMERIGHT, 13
.equ TIMEEND, 4

.equ CLKRATE, 8000000 ; reminder to change values
.equ TIMEDIV, 50 ; additional time division

.macro flip
	IN r16, PORTB
	LDI r17, 1
	EOR r16, r17
	OUT PORTB, r16
.endm

.section .vectors
	RJMP reset ; RESET
	RJMP nointr ; INT0
	RJMP nointr ; PCINT0
	RJMP nointr ; TIMER1_COMPA
	RJMP nointr ; TIMER1_OVF
	RJMP nointr ; TIMER0_OVF
	RJMP nointr ; EE_RDY
	RJMP nointr ; ANA_COMP
	RJMP nointr ; ADC
	RJMP nointr ; TIMER1_COMPB
	RJMP t0_compa ; TIMER0_COMPA
	RJMP nointr ; TIMER0_COMPB
	RJMP nointr ; WDT
	RJMP nointr ; USI_START
	RJMP nointr ; USI_OVF
nointr: ; Void ->
	RJMP reset ; Void ->
t0_compa: ; Void ->
	PUSH r16
	IN r16, SREG
	PUSH r16
	LDS r16, timectr
	DEC r16 ; sets Z flag
	CPI r16, 0
	BRNE 0f ; Int ->
	LDS r16, clock
	INC r16
	STS clock, r16
	LDI r16, TIMEDIV
0: STS timectr, r16
	POP r16
	OUT SREG, r16
	POP r16
	reti ; Void ->
.section .text
reset: ; Unit ->
	initstack
	RCALL initdata
	LDI r16, 0x03 ; PB0 PB1 as output
	OUT DDRB, r16
	LDI r16, 0x00 ; default PB0 PB1 low
	OUT PORTB, r16
	LDI r16, 0x02 ; set Clear Timer on Compare match mode
	OUT TCCR0A, r16
	LDI r16, 250 ; interrupt every 250/prescale clock0 counts
	OUT OCR0A, r16
	LDI r16, 0x03 ; prescale timer0 1/64
	OUT TCCR0B, r16
	LDI r16, 0x10 ; enable timer0 compare match A
	OUT TIMSK, r16
	SEI ; enable interrupts
	LDI r30, lo8(pm(timeleft)) ; function pointer for ijmp
	LDI r31, hi8(pm(timeleft))
loop: ; Unit ->
	LDS r16, clock
	MOV r17, r16
	LDS r18, lastevent
	SUB r17, r18
	LDS r18, etimer
	CP r17, r18
	BRLT loop
	STS lastevent, r16
	;flip
	;RJMP loop
	IJMP ; Unit ->

timeleft: ; Unit ->
	LDI r16, (1<<PINLEFT)
	OUT PORTB, r16
	LDI r16, TIMELEFT
	STS etimer, r16
	LDI r30, lo8(pm(timewait))
	LDI r31, hi8(pm(timewait))
	RJMP loop

timewait: ; Unit ->
	LDI r16, 0x00
	OUT PORTB, r16
	LDI r16, TIMEWAIT
	STS etimer, r16
	LDI r30, lo8(pm(timeright))
	LDI r31, hi8(pm(timeright))
	RJMP loop

timeright: ; Unit ->
	LDI r16, (1<<PINRIGHT)
	OUT PORTB, r16
	LDI r16, TIMERIGHT
	STS etimer, r16
	LDI r30, lo8(pm(timeend))
	LDI r31, hi8(pm(timeend))
	RJMP loop

timeend: ; Unit ->
	LDI r16, 0x00
	OUT PORTB, r16
	LDI r16, TIMEEND
	STS etimer, r16
	LDI r30, lo8(pm(timeleft))
	LDI r31, hi8(pm(timeleft))
	RJMP loop


.section .data
timectr: .byte TIMEDIV
clock: .byte 0 ; freewheeling tick counter, overflows at 255
lastevent: .byte 0
etimer: .byte 1

.section .bss


.section .lfuse
.byte 0xE2
.section .hfuse
.byte 0xDF


Thu Dec 5 09:49:25 EST 2019
blah

Thu Dec 5 09:28:54 EST 2019
test

Thu Dec 5 08:22:18 EST 2019
asdsdasa

Thu Dec 5 07:48:40 EST 2019
vvvv

Thu Dec 5 06:19:13 EST 2019
Zfdgrgr grgrgr grhgrhr

Thu Dec 5 05:09:58 EST 2019
wut

Thu Dec 5 04:09:27 EST 2019
1111111111111

prev | next