cleaned up myc library (M.Z.)

This commit is contained in:
cvs
2003-04-08 13:30:45 +00:00
parent 5ebd84ddc7
commit bfb09e4593
18 changed files with 58 additions and 613 deletions

View File

@@ -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;
}