static struct timespec howMuchTimeFromNow(Timestamp when) { int64_t microseconds = when.microSeconds() - Timestamp::now().microSeconds(); if (microseconds < 100) { microseconds = 100; } struct timespec ts; ts.tv_sec = static_cast<time_t>(microseconds / ZL_USEC_PER_SEC); ts.tv_nsec = static_cast<long>((microseconds % ZL_USEC_PER_SEC) * 1000); return ts; }