timespec to generic code