let it work also on 32 bit platforms. Okay a platform with time_t==double would not work, yet
authorRoker <roker@pep-project.org>
Tue, 12 Jul 2016 16:38:23 +0200
changeset 847967c385ea856
parent 845 d4bb3516e01c
child 848 edd76023d731
let it work also on 32 bit platforms. Okay a platform with time_t==double would not work, yet
src/platform_unix.c
     1.1 --- a/src/platform_unix.c	Tue Jul 12 14:26:50 2016 +0200
     1.2 +++ b/src/platform_unix.c	Tue Jul 12 16:38:23 2016 +0200
     1.3 @@ -56,10 +56,10 @@
     1.4      static unsigned short xsubi[3];
     1.5      if(!seeded)
     1.6      {
     1.7 -        time_t t = time(NULL);
     1.8 -        xsubi[0] = ((unsigned short *)t)[0];
     1.9 -        xsubi[1] = ((unsigned short *)t)[1];
    1.10 -        xsubi[2] = ((unsigned short *)t)[2];
    1.11 +        const long long t = (long long)time(NULL);
    1.12 +        xsubi[0] = (unsigned short)t;
    1.13 +        xsubi[1] = (unsigned short)(t>>16);
    1.14 +        xsubi[2] = (unsigned short)(t>>32);
    1.15          seeded = true;
    1.16      }
    1.17