“chatgpt how to get the last modified time of a file using only posix commandline utilities”
apparently the answer if you want to limit yourself to v6 in theory is to do the same thing but tarball the temporary file with pax and then read out the modified time in list mode with -o 'listopt=%(mtime=%Y-%m-%dT%H:%M:%SZ)T'
if you want to limit yourself to v6 in practice (nobody actually implements listopt), same thing but manually parse the tarball
if you were wondering, apparently the answer is
if test ! -f build/.mtime; then printf '%b' '\n' > build/.mtime; fi; touch -r "$FILE" build/.mtime; TZ=UTC0 diff -u build/.mtime /dev/null | sed '1!d;s/.*\t\([^ ]\) \([^ ]\).*/\1T\2Z/'
(replacing \t with a tab character)
BUT this requires version 7 of POSIX
BUT it should still work in e·g Macintosh even tho they’re not strictly conformant