Fixed compile bugs.

svn path=/trunk/boinc/; revision=280
This commit is contained in:
Eric Heien 2002-08-09 21:43:59 +00:00
parent 00c2a72fd7
commit fec6e862dd
3 changed files with 27 additions and 14 deletions

View File

@ -142,9 +142,7 @@ double boinc_cpu_time() {
);
#else
#ifdef _WIN32
#ifndef WINNT_CLOCK
return UtilGetCPUClock();
#else
#ifdef WINNT_CLOCK
HANDLE hProcess;
FILETIME creationTime,exitTime,kernelTime,userTime;
@ -167,11 +165,21 @@ double boinc_cpu_time() {
// Convert to seconds and return
return(totTime / 10000000.0);
} else {
CloseHandle(hProcess);
return ((double)clock())/CLOCKS_PER_SEC;
}
CloseHandle(hProcess);
// ... fall through
#endif // WINNT_CLOCK
static bool first=true;
static DWORD last_count = 0;
if (first) {
last_count = GetTickCount();
first = true;
}
DWORD cur = GetTickCount();
double x = (cur - last_count)/1000.;
last_count = cur;
return x;
#endif // _WIN32
#endif

View File

@ -1,11 +1,15 @@
#include "graphics_api.h"
#include "parse.h"
void write_graphics_file(FILE* f, GRAPHICS_INFO& gi) {
fprintf(f,
"<graphics_xsize>%d</graphics_xsize>\n"
"<graphics_ysize>%d</graphics_ysize>\n"
"<graphics_refresh_period>%f</graphics_refresh_period>\n",
gi.graphics.xsize,
gi.graphics.ysize,
gi.graphics.refresh_period,
gi.xsize,
gi.ysize,
gi.refresh_period
);
}
@ -13,9 +17,9 @@ int parse_graphics_file(FILE* f, GRAPHICS_INFO& gi) {
char buf[256];
while (fgets(buf, 256, f)) {
if (match_tag(buf, "<graphics_info>")) return 0;
else if (parse_int(buf, "<graphics_xsize>", gi.graphics.xsize)) continue;
else if (parse_int(buf, "<graphics_ysize>", gi.graphics.ysize)) continue;
else if (parse_double(buf, "<graphics_refresh_period>", gi.graphics.refresh_period)) continue;
else if (parse_int(buf, "<graphics_xsize>", gi.xsize)) continue;
else if (parse_int(buf, "<graphics_ysize>", gi.ysize)) continue;
else if (parse_double(buf, "<graphics_refresh_period>", gi.refresh_period)) continue;
else fprintf(stderr, "parse_core_file: unrecognized %s", buf);
}
return -1;

View File

@ -1,8 +1,9 @@
struct APP_IN_GRAPHICS {
#include <stdio.h>
struct GRAPHICS_INFO {
int xsize;
int ysize;
double refresh_period;
char shmem_seg_name[32];
};
struct APP_OUT_GRAPHICS {