⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 millitime.cpp

📁 使用windows系统中的毫秒时间
💻 CPP
字号:
/* FTIME.C: This program uses _ftime to obtain the current
 * time and then stores this time in timebuffer.
 */

#include <stdio.h>
#include <sys/timeb.h>
#include <time.h>
//#include <winbase.h>


void main( void )
{
   int result;
   struct _timeb timebuffer,timebuffer1;
   char *timeline;

   _ftime( &timebuffer );
   timeline = ctime( & ( timebuffer.time ) );

   printf( "The time is %.19s.%hu %s", &timeline[0], timebuffer.millitm, &timeline[20] );

   printf( "The Value of timeline is %s",timeline);

   printf( "The value of timebuffer.millitm is %d\n",timebuffer.millitm);

   for(int i=0;i<9999999*2;i++)
   {
   }
   _ftime( &timebuffer1 );
   printf( "The value of timebuffer.millitm is %d\n",timebuffer1.millitm);
   
   if(timebuffer1.millitm > timebuffer.millitm)
	   result = timebuffer1.millitm - timebuffer.millitm;
   else
	   result = 1000 - timebuffer.millitm + timebuffer1.millitm;
   printf( "The time between two _ftime is %d\n",result);
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -