COPY command does not support preprocessing - you can't do it "at the time of loading "
https://www.postgresql.org/docs/current/static/sql-copy.html
In CSV format, all characters are significant. A quoted value
surrounded by white space, or any characters other than DELIMITER,
will include those characters. This can cause errors if you import
data from a system that pads CSV lines with white space out to some
fixed width. If such a situation arises you might need to preprocess
the CSV file to remove the trailing white space, before importing the
data into PostgreSQL.
I think here the best solution would be importing data with spaces and then
update t set attr = rtim(attr);