rewrite the ffi tutorial

The example with OpenSSL is incorrect, because OpenSSL is using a
static variable for the return value and isn't thread-safe.

The gettimeofday example is specific to POSIX systems so it's not ideal.