rewrite tmpl_to_atype()
There is a weird corner case where it returns an error without
printing any complaints. But only for ubuntu-24-linux-gcc-ndebug.
https://github.com/FreeRADIUS/freeradius-server/actions/runs/
14692203645/job/
41229053000#step:10:2949
The input is a tmpl type data, with data type time_delta.
The output is a fr_time_delta_t.
Both clang scan and coverity think that everything is fine.
All runs with ubsan / asan / lsan don't show errors.
Yet it still fails, but only on one platform. And consistently.
Since all attempts at debugging have failed, the solution is to
change the code so that it more clearly separates out the various
paths. Another result is that it does less copying of intermediate
boxes.