Пример #1
0
struct timespec TimerQueue::howMuchTimeFromNow(
			Timestamp when){
	int64_t microseconds = 
		when.getMircoSecondsSinceEpoch()
		- Timestamp::now().getMircoSecondsSinceEpoch();

	if (microseconds < 100){
		microseconds = 100;
	}

	struct timespec ts;
	
	ts.tv_sec = static_cast<time_t>(microseconds/Timestamp::kMincroSecondsPerSecond);
	
	ts.tv_nsec = static_cast<long> (
				(microseconds % 
				 Timestamp::kMincroSecondsPerSecond) 
				* 1000);
	return ts;
}