Code:
gettimeofday
Will not work with FreePascal. You should use fpGetTimeOfDay instead, and unit Unix.