subtract seconds from seconds
Posted: Thu Jun 02, 2016 2:58 am
Hello
I have been experimenting with this problem of returning the length of time elapsed between one button (H) clicked for going to sleep and another (9) clicked for standing up - and returning the result to a field "Trap5". But the result is only the actual time when button 9 is clicked.
Can somebody detect which errors I commit ?
if item 1 of parameterlist is "H" and item 2 of parameterlist is "Krop" then
put trap into chmode
put the seconds into tobed
put tab & item 1 of parameterlist & tab into trapbox
end if
if item 1 of parameterlist is "9" and item 2 of parameterlist is "Krop" then
put trap into chimed
-- set the standup of this stack to the seconds
put the seconds into standup
-- put (the seconds - the tobed of this stack) into sleeptime
subtract tobed from standup
-- subtract 3600 from sleeptime
put the value of standup into sleeptime
convert sleeptime to short time
if the number of chars of sleeptime = 8 then
put empty into char 6 to 8 of sleeptime
end if
put "Total sleep:" && sleeptime into field "Trap5"
put tab & item 1 of parameterlist & tab into trapbox
set the tobed of this stack to empty
end if
Hopefully
Kresten www.phenomenalog.dk
I have been experimenting with this problem of returning the length of time elapsed between one button (H) clicked for going to sleep and another (9) clicked for standing up - and returning the result to a field "Trap5". But the result is only the actual time when button 9 is clicked.
Can somebody detect which errors I commit ?
if item 1 of parameterlist is "H" and item 2 of parameterlist is "Krop" then
put trap into chmode
put the seconds into tobed
put tab & item 1 of parameterlist & tab into trapbox
end if
if item 1 of parameterlist is "9" and item 2 of parameterlist is "Krop" then
put trap into chimed
-- set the standup of this stack to the seconds
put the seconds into standup
-- put (the seconds - the tobed of this stack) into sleeptime
subtract tobed from standup
-- subtract 3600 from sleeptime
put the value of standup into sleeptime
convert sleeptime to short time
if the number of chars of sleeptime = 8 then
put empty into char 6 to 8 of sleeptime
end if
put "Total sleep:" && sleeptime into field "Trap5"
put tab & item 1 of parameterlist & tab into trapbox
set the tobed of this stack to empty
end if
Hopefully
Kresten www.phenomenalog.dk