@@ -474,17 +474,17 @@ OAES_RET oaes_sprintf(
474474static void oaes_get_seed ( char buf [RANDSIZ + 1 ] )
475475{
476476 #if !defined(__FreeBSD__ ) && !defined(__OpenBSD__ )
477- struct timeb timer ;
477+ struct timespec timer ;
478478 struct tm * gmTimer ;
479479 char * _test = NULL ;
480480
481- ftime (& timer );
482- gmTimer = gmtime ( & timer .time );
483- _test = (char * ) calloc ( sizeof ( char ), timer .millitm );
481+ timespec_get (& timer , TIME_UTC );
482+ gmTimer = gmtime ( & timer .time_sec );
483+ _test = (char * ) calloc ( sizeof ( char ), timer .tv_nsec );
484484 sprintf ( buf , "%04d%02d%02d%02d%02d%02d%03d%p%d" ,
485485 gmTimer -> tm_year + 1900 , gmTimer -> tm_mon + 1 , gmTimer -> tm_mday ,
486- gmTimer -> tm_hour , gmTimer -> tm_min , gmTimer -> tm_sec , timer .millitm ,
487- _test + timer .millitm , GETPID () );
486+ gmTimer -> tm_hour , gmTimer -> tm_min , gmTimer -> tm_sec , timer .tv_nsec ,
487+ _test + timer .tv_nsec , GETPID () );
488488 #else
489489 struct timeval timer ;
490490 struct tm * gmTimer ;
@@ -506,17 +506,17 @@ static void oaes_get_seed( char buf[RANDSIZ + 1] )
506506static uint32_t oaes_get_seed (void )
507507{
508508 #if !defined(__FreeBSD__ ) && !defined(__OpenBSD__ ) && !defined(__ANDROID__ )
509- struct timeb timer ;
509+ struct timespec timer ;
510510 struct tm * gmTimer ;
511511 char * _test = NULL ;
512512 uint32_t _ret = 0 ;
513513
514- ftime (& timer );
515- gmTimer = gmtime ( & timer .time );
516- _test = (char * ) calloc ( sizeof ( char ), timer .millitm );
514+ timespec_get (& timer , TIME_UTC );
515+ gmTimer = gmtime ( & timer .tv_sec );
516+ _test = (char * ) calloc ( sizeof ( char ), timer .tv_nsec );
517517 _ret = gmTimer -> tm_year + 1900 + gmTimer -> tm_mon + 1 + gmTimer -> tm_mday +
518- gmTimer -> tm_hour + gmTimer -> tm_min + gmTimer -> tm_sec + timer .millitm +
519- (uintptr_t ) ( _test + timer .millitm ) + GETPID ();
518+ gmTimer -> tm_hour + gmTimer -> tm_min + gmTimer -> tm_sec + timer .tv_nsec +
519+ (uintptr_t ) ( _test + timer .tv_nsec ) + GETPID ();
520520 #else
521521 struct timeval timer ;
522522 struct tm * gmTimer ;
0 commit comments