Convert some C functions to rust functions

Right now on linux, an empty executable with LTO still depends on librt becaues
of the clock_gettime function in rust_builtin.o, but this commit moves this
dependency into a rust function which is subject to elimination via LTO.

Also, it's more fun having things written in rust than in C!