请输入您要查询的百科知识:

 

词条 _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\",

time1);

printf( "Milliseconds: %d\", millitm1);

printf( "Minutes between UTC and local time: %d\", timezone1);

printf( "Daylight savings time flag (1 means Daylight time is in "

"effect): %d\", dstflag1);

err = ctime_s( timeline, 26, & ( timebuffer.time ) );

if (err)

{

printf("Invalid argument to ctime_s. ");

}

printf( "The time is %.19s.%hu %s", timeline, timebuffer.millitm,

&timeline[20] );

}

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/25 3:49:12