Skip to content

Commit

Permalink
lib: guid_128_generate() shouldn't generate invalid timestamps
Browse files Browse the repository at this point in the history
The nsec validity check must take into account the soon-to-be-done increment.
  • Loading branch information
Josef 'Jeff' Sipek committed Jun 7, 2017
1 parent c104ea8 commit 8b2aaea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/guid.c
Expand Up @@ -75,7 +75,7 @@ void guid_128_generate(guid_128_t guid_r)
when a GUID was created. */
ts.tv_sec = ioloop_timeval.tv_sec;
ts.tv_nsec = ioloop_timeval.tv_usec*1000;
} else if ((uint32_t)ts.tv_nsec < 1000000000) {
} else if (ts.tv_nsec < 999999999L) {
ts.tv_nsec++;
} else {
ts.tv_sec++;
Expand Down

0 comments on commit 8b2aaea

Please sign in to comment.