global numer, total_time
link datefns
procedure main()
initdate()
inact := open("Activities_Etc.txt","r") | stop("cannot open Activities_Etc.txt")
write(" Dennis J. Darland's Activities Since 2017/05/05 18:40:00 as of "|| &date || " " || &clock)
write(&version)
header()
title := "NA"
priority := -1
item_time2 := -1
created := "NA"
total_time := 0.0
ualpha := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lalpha := 'abcdefghijklmnopqrstuvwxyz'
numer := '1234567890'
numer2 := '1234567890.'
ws := ' '
alpha := lalpha ++ ualpha
alphanum := alpha ++ numer
spec := ' '
while line := read(inact) do {
if line ?? Fence() || Break('(') => title || "(" || Break(')') => priority || ") (" || Break(')') => item_time || ") (" || Break(')') => created || ")" || Rem() then {
if item_time ?? ( "Time Spent: " || Span(numer2) => item_time2 || " H" ) then {
total_time +:= item_time2
}
}
}
close(inact)
# PART 2 ########################################################
inact := open("Activities_Etc.txt","r") | stop("cannot open Activities_Etc.txt")
while line := read(inact) do {
if *line > 5 then {
if line ?? Fence() || Break('(') => title || "(" || Break(')') => priority || ") (" || Break(')') => item_time || ") (" || Break(')') => created || ")" || Rem() then {
if item_time ?? "Time Spent: " || Span(numer2) => item_time2 || " H" then {
percent := item_time2 * 100.0 / total_time
ave := item_time2 / range("2017/05/05 18:40:00", &date || " " || &clock)
write("
" || title || " | " || shrink_H(item_time2) || " | " || shrink(percent) || "% | " || shrink_H(ave) || " |
")
}
}
}
}
ave := total_time / range("2017/05/05 18:40:00", &date || " " || &clock)
write("Overall | " || shrink_H(total_time) || " | 100.0 % | " || shrink_H(ave) || " | ")
trailer()
end
procedure range(start_tm,end_tm)
local ans
ans := cvtdate(end_tm) - cvtdate(start_tm)
return(ans)
end
procedure cvtdate(in)
local yr, mo, da, hr, min, out
in ?? Break("/") => yr || "/" || Break("/") => mo || "/" || Break(" ") => da || " " || Break(":") => hr || ":" || Break(":") -> min || ":"
out := julian(date_rec(yr,mo,da)) + hr / 24.0 + min / (24.0 * 60.0)
return(out)
end
procedure shrink(in)
local out
in ||:= "000000"
in ?? Len(6) => out
return(out)
end
procedure shrink_H(in)
local hund, hours, minutes
in ||:= "00"
in ?? Span(numer) => hours || Len(1) || Len(2) => hund
minutes := hund * 60 / 100
return( hours || " H " || minutes || " M")
end
procedure trailer()
write("")
# OUTPUT = 'Note: On May 20, I made the following calculation:
'
# OUTPUT = 'I started recording 5/5/17.
'
# OUTPUT = '5/15/17 added the category of dennisdarland.com, email, facebook, etc (d), which was previously included in music (m)
'
# OUTPUT = 'So:
'
# OUTPUT = '15 * m + 10 * d = 46
'
# OUTPUT = '5 * d = 20
'
# OUTPUT = 'giving:
'
# OUTPUT = 'd = 4
'
# OUTPUT = 'm = 0.4
'
# OUTPUT = '
'
# OUTPUT = 'NOTES:'
# OUTPUT = 'I expect that the time listening to music is at least an hour a day, and that the time on dennisdarland.com will drop when things slow doen.
'
# OUTPUT = 'I am using:
'
# OUTPUT = 'Abstract Spoon ToDo List to gather the data.
'
# OUTPUT = 'Then a snobol4 program I wrote to add percentages, averages and html formatting.
'
# OUTPUT = 'The snobol program is HERE.
'
write("