Implements gettime() system call