Fix uses of posix gettimeofday to works on lua 5.1 and 5.2.