diff --git a/Common/Timer.cpp b/Common/Timer.cpp index 991d559783c1404d7179c441dfd49c4af1df779f..24b4a9c81b4fa0f8c554dbf12620335bef8b8bdd 100644 --- a/Common/Timer.cpp +++ b/Common/Timer.cpp @@ -1,4 +1,4 @@ -// $Id: Timer.cpp,v 1.18 2006-02-25 00:15:00 geuzaine Exp $ +// $Id: Timer.cpp,v 1.19 2006-02-25 07:02:20 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -25,16 +25,17 @@ #include <sys/time.h> #include <unistd.h> -long GetTimeMilliSeconds() +double GetTimeInSeconds() { struct timeval tp; gettimeofday(&tp, (struct timezone *)0); - return (long)tp.tv_sec * 1000000 + (long)tp.tv_usec; + double t = (double)tp.tv_sec + 1.e-6 * (double)tp.tv_usec; + return t; } -void SleepMilliSeconds(int ms) +void SleepInSeconds(double s) { - usleep(1000 * ms); + usleep((long)(1.e6 * s)); } #else // pure windows @@ -42,16 +43,17 @@ void SleepMilliSeconds(int ms) #include "Gmsh.h" #include <windows.h> -long GetTimeMilliSeconds() +long GetTimeInSeconds() { FILETIME ft; GetSystemTimeAsFileTime(&ft); - return (long)ft.dwHighDateTime * 100000 + (long)ft.dwLowDateTime / 10; + double t = 1.e2 * (double)ft.dwHighDateTime; + return t; } -void SleepMilliSeconds(int ms) +void SleepInSeconds(double s) { - Sleep(ms); + Sleep((long)(1.e3 * s)); } #endif diff --git a/Common/Timer.h b/Common/Timer.h index 4d380bbc3dc010f3a601b4c1e8b991bea440074d..51a227829edb5a593738aade8913fc73af10e996 100644 --- a/Common/Timer.h +++ b/Common/Timer.h @@ -20,7 +20,7 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -long GetTimeMilliSeconds(); -void SleepMilliSeconds(int ms); +double GetTimeInSeconds(); +void SleepInSeconds(double s); #endif diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 733f20ae5437ec7ceadd0c619e6753ff9911f60d..d2b50e3d9296e869608c94c2d4333e01c8680da1 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.410 2006-02-25 00:15:00 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.411 2006-02-25 07:02:20 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -520,15 +520,15 @@ void ManualPlay(int time, int step) void status_play_cb(CALLBACK_ARGS) { - static long anim_time; + static double anim_time; WID->set_anim_buttons(0); stop_anim = 0; - anim_time = GetTimeMilliSeconds(); + anim_time = GetTimeInSeconds(); while(1) { if(stop_anim) break; - if(GetTimeMilliSeconds() - anim_time > 1.e6 * CTX.post.anim_delay) { - anim_time = GetTimeMilliSeconds(); + if(GetTimeInSeconds() - anim_time > CTX.post.anim_delay) { + anim_time = GetTimeInSeconds(); ManualPlay(!CTX.post.anim_cycle, 1); } WID->check(); diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index e90b551b4d3a4eb6b9521e0f8f306b7bcbcf62ec..0d97676716139179548b0b8530041dce923ce3f0 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -125,7 +125,7 @@ #line 1 "Gmsh.y" -// $Id: Gmsh.tab.cpp,v 1.258 2006-02-24 22:08:13 geuzaine Exp $ +// $Id: Gmsh.tab.cpp,v 1.259 2006-02-25 07:02:20 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -4479,7 +4479,7 @@ case 129: #line 1832 "Gmsh.y" { if(!strcmp(yyvsp[-2].c, "Sleep")){ - SleepMilliSeconds((int)(yyvsp[-1].d * 1000.)); + SleepInSeconds(yyvsp[-1].d); } else if(!strcmp(yyvsp[-2].c, "Remesh")){ ReMesh(THEM); diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index be879dcff671bddfc9106b75d64cd317057a0009..3b0dcbf8abf7a0947c34a5442c609c4a13e370ef 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -1,5 +1,5 @@ %{ -// $Id: Gmsh.y,v 1.221 2006-02-24 22:07:08 geuzaine Exp $ +// $Id: Gmsh.y,v 1.222 2006-02-25 07:02:21 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -1831,7 +1831,7 @@ Command : | tSTRING FExpr tEND { if(!strcmp($1, "Sleep")){ - SleepMilliSeconds((int)($2 * 1000.)); + SleepInSeconds($2); } else if(!strcmp($1, "Remesh")){ ReMesh(THEM); diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index d8e230010fecfae9377a805c578e6e45123c8ee4..51efcd24e8c597d91c8090b9ed358d3b02f92f6c 100644 --- a/Parser/Gmsh.yy.cpp +++ b/Parser/Gmsh.yy.cpp @@ -2,7 +2,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.257 2006-02-24 22:08:13 geuzaine Exp $ + * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.258 2006-02-25 07:02:21 geuzaine Exp $ */ #define FLEX_SCANNER @@ -727,7 +727,7 @@ char *yytext; #line 1 "Gmsh.l" #define INITIAL 0 #line 2 "Gmsh.l" -// $Id: Gmsh.yy.cpp,v 1.257 2006-02-24 22:08:13 geuzaine Exp $ +// $Id: Gmsh.yy.cpp,v 1.258 2006-02-25 07:02:21 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // diff --git a/TODO b/TODO index b0b6e1860f580750af17dcbfb0e1de30f48a3494..e845af13bfd95e5f3dd28a6bc4421f73e931347f 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -$Id: TODO,v 1.122 2006-02-22 17:25:03 geuzaine Exp $ +$Id: TODO,v 1.123 2006-02-25 07:02:20 geuzaine Exp $ ******************************************************************** @@ -38,12 +38,7 @@ curve/surface/volume or loop over all elements.) ******************************************************************** On Windows WITHOUT Cygwin: -- rewrite solver interface (GmshServer and GmshClient) - Functions in parser don't seem to work -- fix compilation issues in triangle (timezone) and gl2ps (zlib??) -- need alternative timer functions (Timer.cpp, ParUtils.cpp) -- there is a bug in fwrite/fread as used for binary post-processing - views (need to investigate "premature end of file" message) ********************************************************************