_ftime

_ftime是一種函式,功能是返回當前時間。

基本介紹

  • 外文名:_ftime
  • 類型:函式
  • 函式原型:void _ftime(
  • 學科:程式設計
函式簡介,程式示例,

函式簡介

函式原型:
void _ftime(
struct _timeb *timeptr
);
頭檔案:
<sys/types.h> and <sys/timeb.h>
函式功能:
返回當前時間
參數說明:
struct _timeb {
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
結構體定義於<sys/timeb.h>下
相關函式:
void _ftime32(
struct __timeb32 *timeptr
);
void _ftime64(
struct __timeb64 *timeptr
);

程式示例

#include <stdio.h>
#include <sys/timeb.h>
#include <time.h>
int main( void )
{
struct _timeb timebuffer;
char timeline[26];
errno_t err;
time_t time1;
unsigned short millitm1;
short timezone1;
short dstflag1;
_ftime( &timebuffer ); // C4996
// Note: _ftime is deprecated; consider using _ftime_s instead
time1 = timebuffer.time;
millitm1 = timebuffer.millitm;
timezone1 = timebuffer.timezone;
dstflag1 = timebuffer.dstflag;
printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
time1);
printf( "Milliseconds: %d\n", millitm1);
printf( "Minutes between UTC and local time: %d\n", timezone1);
printf( "Daylight savings time flag (1 means Daylight time is in "
"effect): %d\n", dstflag1);

相關詞條

熱門詞條

聯絡我們