mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
Bug - Duplicate UUIDs under Cygwin
- Fixed bug caused by using a high-resolution timer (gettimeofday) on Windows, which only has a 10ms resolution timer. Consequently the random number seed used was from a significantly reduced pool, which leads to duplicate UUIDs.
This commit is contained in:
parent
0a5e380bbf
commit
e6d47f233b
1 changed files with 3 additions and 5 deletions
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/time.h>
|
#include <time.h>
|
||||||
#include "Context.h"
|
#include "Context.h"
|
||||||
#include "../auto.h"
|
#include "../auto.h"
|
||||||
|
|
||||||
|
@ -36,12 +36,10 @@ Context context;
|
||||||
int main (int argc, char** argv)
|
int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
// Set up randomness.
|
// Set up randomness.
|
||||||
struct timeval tv;
|
|
||||||
gettimeofday (&tv, NULL);
|
|
||||||
#ifdef HAVE_SRANDOM
|
#ifdef HAVE_SRANDOM
|
||||||
srandom (tv.tv_usec);
|
srandom (time (NULL));
|
||||||
#else
|
#else
|
||||||
srand (tv.tv_usec);
|
srand (time (NULL));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue