cleaned up myc library (M.Z.)
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
#include <assert.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
/*
|
||||
#include <sys/types.h>
|
||||
#include <sys/timeb.h>
|
||||
#include "sys_util.h"
|
||||
int ftime (struct timeb *__timeptr);
|
||||
*/
|
||||
#include "myc_fortran.h"
|
||||
#include "myc_time.h"
|
||||
|
||||
int ftime (struct timeb *__timeptr); /* for some reason not defined in timeb.h with flag -std1 */
|
||||
|
||||
static time_t my_base=0;
|
||||
|
||||
@@ -34,12 +38,19 @@ int mycNow(void) {
|
||||
}
|
||||
|
||||
int mycMsecSince(int since) {
|
||||
/*
|
||||
struct timeb now;
|
||||
*/
|
||||
struct timeval now;
|
||||
int msec;
|
||||
|
||||
if (my_base == 0) initBase();
|
||||
/*
|
||||
ftime(&now);
|
||||
msec = (now.time - my_base) % (24*3600) * 1000 + now.millitm - since;
|
||||
*/
|
||||
gettimeofday(&now, NULL);
|
||||
msec = (now.tv_sec - my_base) % (24*3600) * 1000 + now.tv_usec/1000 - since;
|
||||
if (msec < 0) msec+=24*3600000;
|
||||
return msec;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user