I learned a lot from this. Many thanks to everyone for sharing their ideas.
One gotacha: The STRINGIN record translates the time stamp to a strftime conversion, %M for testing and %j for production. That output is still a string, "001" through "365". However, CALC takes this string and casts it into an integer. I haven't confirmed this assumed cast from base source code yet, so correct me if I'm wrong.
>cat db/counter.db
record(bi, "$(user):now") {
field(PINI, "YES")
field(SCAN, "1 second")
field(FLNK, "$(user):day")
}
record(stringin, "$(user):day") {
field(DTYP, "Soft Timestamp")
field(INP, "@%M") # for testing purposes using 1 minute
field(TSEL, "$(user):now.TIME")
field(FLNK, "$(user):clear")
}
record(calcout, "$(user):clear") {
field(INPA, "$(user):day NPP MS")
field(INPB, "1000")
field(CALC, "A>B?1:0;B:=A")
field(DOPT, "Use CALC")
field(OOPT, "Every Time")
field(OUT, "$(user):count.C PP")
}
record(calc, "$(user):count") {
field(INPC, "$(user):clear.VAL")
field(VAL, "0")
#field(TPRO, 1)
field(CALC, "C?0:VAL+1")
}