I recently learned of problems with Modulo:

C (ISO 1990)	%	Implementation defined
C (ISO 1999)	%	Dividend[1]
C++ (ISO 1998)	%	Implementation defined[2]
C++ (ISO 2011)	%	Dividend

http://en.wikipedia.org/wiki/Modulo_operation

The sign of the result can very, which is bad, but even worse on some systems the returned value might be semantically different. For instance `20 % 7` might be `6` (`20 - (2 * 7)`) or `1` (`(3 * 7) - 20`) depending on the implementation, which is super weird. It is something that @dirk-thomas ran into at some point on an older compiler for an embedded computer. That's not likely to come up here, but still it might be prudent to do something like this:

```c++
  int64_t sec_diff = tv_nsec / (int)1e6;
  expiry.tv_nsec = tv_nsec - (int)(1e6 * sec_diff);
  expiry.tv_sec += sec_diff;
```