From fec6e862dd45e4dd4fb39fb62a27a49dd76a44d6 Mon Sep 17 00:00:00 2001 From: Eric Heien Date: Fri, 9 Aug 2002 21:43:59 +0000 Subject: [PATCH] Fixed compile bugs. svn path=/trunk/boinc/; revision=280 --- api/boinc_api.C | 20 ++++++++++++++------ api/graphics_api.C | 16 ++++++++++------ api/graphics_api.h | 5 +++-- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/api/boinc_api.C b/api/boinc_api.C index 6389276438..e4b97f9eeb 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -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 diff --git a/api/graphics_api.C b/api/graphics_api.C index f20e681a39..807195107a 100755 --- a/api/graphics_api.C +++ b/api/graphics_api.C @@ -1,11 +1,15 @@ +#include "graphics_api.h" + +#include "parse.h" + void write_graphics_file(FILE* f, GRAPHICS_INFO& gi) { fprintf(f, "%d\n" "%d\n" "%f\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, "")) return 0; - else if (parse_int(buf, "", gi.graphics.xsize)) continue; - else if (parse_int(buf, "", gi.graphics.ysize)) continue; - else if (parse_double(buf, "", gi.graphics.refresh_period)) continue; + else if (parse_int(buf, "", gi.xsize)) continue; + else if (parse_int(buf, "", gi.ysize)) continue; + else if (parse_double(buf, "", gi.refresh_period)) continue; else fprintf(stderr, "parse_core_file: unrecognized %s", buf); } return -1; diff --git a/api/graphics_api.h b/api/graphics_api.h index a543d4730c..85766c505b 100755 --- a/api/graphics_api.h +++ b/api/graphics_api.h @@ -1,8 +1,9 @@ -struct APP_IN_GRAPHICS { +#include + +struct GRAPHICS_INFO { int xsize; int ysize; double refresh_period; - char shmem_seg_name[32]; }; struct APP_OUT_GRAPHICS {