Exemple #1
0
/* and fraction (in nanoseconds). */
void
gp_get_realtime(long *pdt)
{	struct timeval tp;

#if gettimeofday_no_timezone			/* older versions of SVR4 */
	{	if ( gettimeofday(&tp) == -1 )
		  {	lprintf("Ghostscript: gettimeofday failed!\n");
			gs_exit(1);
		  }
	}
#else						/* All other systems */
	{	struct timezone tzp;
		if ( gettimeofday(&tp, &tzp) == -1 )
		  {	lprintf("Ghostscript: gettimeofday failed!\n");
			gs_exit(1);
		  }
	}
#endif

	/* tp.tv_sec is #secs since Jan 1, 1970 */
	pdt[0] = tp.tv_sec;

	/* Some Unix systems (e.g., Interactive 3.2 r3.0) return garbage */
	/* in tp.tv_usec.  Try to filter out the worst of it here. */
	pdt[1] = tp.tv_usec >= 0 && tp.tv_usec < 1000000 ? tp.tv_usec*1000 : 0;

#ifdef DEBUG_CLOCK
	printf("tp.tv_sec = %d  tp.tv_usec = %d  pdt[0] = %ld  pdt[1] = %ld\n",
		tp.tv_sec, tp.tv_usec, pdt[0], pdt[1]);
#endif
}
/* our exit handler */
void win_exit(void)
{
	/* if we didn't exit through gs_exit() then do so now */
	if (win_init)
		gs_exit(0);

	fcloseall();
	DestroyWindow(hwndeasy);
}
bool GlShader::load ( GLenum type, const char* filename )
 {
   std::ifstream in ( filename, std::ios::in | std::ios::binary );
   if ( !in.is_open() ) { std::cout<<"Could not load shader ["<<filename<<"] !\n"; gs_exit(1); }

   std::string s;
   in.seekg ( 0, std::ios::end );
   s.resize ( (size_t) in.tellg() );
   in.seekg ( 0, std::ios::beg );
   in.read ( &s[0], s.size() );
   set ( type, &s[0] );
   return true;
}
Exemple #4
0
/* and fraction (in nanoseconds since midnight). */
void
gp_get_realtime(long *pdt)
{	struct timeval tp;
	struct timezone tzp;

	if ( gettimeofday(&tp, &tzp) == -1 )
	   {	lprintf("Ghostscript: gettimeofday failed!\n");
		gs_exit(1);
	   }

	/* tp.tv_sec is #secs since Jan 1, 1970 */
	pdt[0] = tp.tv_sec;
	pdt[1] = tp.tv_usec * 1000;

#ifdef DEBUG_CLOCK
	printf("tp.tv_sec = %d  tp.tv_usec = %d  pdt[0] = %ld  pdt[1] = %ld\n",
		tp.tv_sec, tp.tv_usec, pdt[0], pdt[1]);
#endif
}
Exemple #5
0
int main (int argc, char *argv[]){
  char buf[256];

#ifdef GRAPHICS
  gs_init(WIDTH, HEIGHT);
#endif
  
  sw_init();
  sw_start();
  RoadMap();
  sw_stop();

  sw_timeString(buf);
  
  printf("Time taken: %s\n",buf);

#ifdef GRAPHICS
  gs_exit();
#else
  printf("CRC is %x\n",crc);
#endif

  return 0;
}