--- gforth/prim 2011/10/18 13:13:53 1.258 +++ gforth/prim 2011/12/19 19:43:29 1.263 @@ -1103,6 +1103,22 @@ lshift ( u1 n -- u2 ) core l_shift : 0 ?DO 2* LOOP ; +umax ( u1 u2 -- u ) core +if (u1 IF swap THEN drop ; + \g compare \ comparisons(prefix, args, prefix, arg1, arg2, wordsets...) @@ -2033,6 +2049,19 @@ duser = timeval2us(&time1); dsystem = DZERO; #endif +ntime ( -- dtime ) gforth +""Report the current time in nanoseconds since some epoch."" +struct timespec time1; +#ifdef HAVE_CLOCK_GETTIME +clock_gettime(CLOCK_REALTIME,&time1); +#else +struct timeval time2; +gettimeofday(&time2,NULL); +time1.tv_sec = time2.tv_sec; +time1.tv_nsec = time2.tv_usec*1000; +#endif +dtime = timespec2ns(&time1); + \+ \+floating