=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/builtin/time.c,v retrieving revision 1.5 retrieving revision 1.8 diff -u -p -r1.5 -r1.8 --- OpenXM_contrib2/asir2000/builtin/time.c 2005/11/12 08:13:13 1.5 +++ OpenXM_contrib2/asir2000/builtin/time.c 2011/05/11 06:03:53 1.8 @@ -45,17 +45,20 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/builtin/time.c,v 1.4 2005/11/12 08:10:56 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/builtin/time.c,v 1.7 2009/03/16 16:43:02 ohara Exp $ */ #include "ca.h" #include "parse.h" +#include void Ptime(), Pcputime(), Pcurrenttime(), Ptstart(), Ptstop(); +void Pdcurrenttime(); struct ftab time_tab[] = { {"time",Ptime,0}, {"cputime",Pcputime,1}, {"currenttime",Pcurrenttime,0}, + {"dcurrenttime",Pdcurrenttime,0}, {"tstart",Ptstart,0}, {"tstop",Ptstop,0}, {0,0,0}, @@ -73,6 +76,14 @@ Q *rp; t = (int)get_current_time(); STOQ(t,*rp); } +void Pdcurrenttime(rp) +Real *rp; +{ + double t; + + t = get_current_time(); MKReal(t,*rp); +} + void Ptstart(rp) pointer *rp; { @@ -103,24 +114,24 @@ LIST *listp; Real re,rg,rr; NODE a,b,w,r; Q words; - long t; - int u,l; + size_t t; + unsigned int u,l; N n; double rtime; double get_rtime(); rtime = get_rtime(); MKReal(rtime,rr); t = get_allocwords(); -#if defined(LONG_IS_64BIT) - u = t>>32; l = t&(0xffffffff); - if ( !u ) STOQ(l,words); - else { - n = NALLOC(2); PL(n)=2; BD(n)[0] = l; BD(n)[1] = u; - NTOQ(n,1,words); + if(sizeof(size_t)>sizeof(int)) { + u = t>>(sizeof(int)*CHAR_BIT); l = t&(~0); + if ( !u ) STOQ(l,words); + else { + n = NALLOC(2); PL(n)=2; BD(n)[0] = l; BD(n)[1] = u; + NTOQ(n,1,words); + } + }else { + STOQ(t,words); } -#else - STOQ(t,words); -#endif get_eg(&eg); MKReal(eg.exectime,re); MKReal(eg.gctime,rg); MKNODE(r,rr,0); MKNODE(w,words,r); MKNODE(a,rg,w); MKNODE(b,re,a); MKLIST(*listp,b);