Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

_ftime, _ftime64

Get the current time.

void _ftime( 
   struct _timeb *timeptr 
void _ftime64( 
   struct __timeb64 *timeptr 


Pointer to a _timeb or __timeb64 structure.


The _ftime function gets the current local time and stores it in the structure pointed to by timeptr. The _timeb structure is defined in SYS\TIMEB.H. It contains four fields:

Nonzero if daylight savings time is currently in effect for the local time zone. (See _tzset for an explanation of how daylight savings time is determined.)
Fraction of a second in milliseconds.
Time in seconds since midnight (00:00:00), January 1, 1970, coordinated universal time (UTC).
Difference in minutes, moving westward, between UTC and local time. The value of timezone is set from the value of the global variable _timezone (see _tzset).

_ftime64, which uses the __timeb64 structure, allows file-creation dates to be expressed up through 23:59:59, December 31, 3000, UTC, whereas _ftime only represents dates through 19:14:07 January 18, 2038, UTC. Midnight, January 1, 1970, is the lower bound of the date range for all these functions.


Function Required header Compatibility
_ftime <sys/types.h> and <sys/timeb.h> Win 98, Win Me, Win NT, Win 2000, Win XP
_ftime64 <sys/types.h> and <sys/timeb.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.


// crt_ftime.c
/* This program uses _ftime64 to obtain the current
 * time and then stores this time in timebuffer.

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

int main( void )
   struct __timeb64 timebuffer;
   char *timeline;

   _ftime64( &timebuffer );
   timeline = _ctime64( & ( timebuffer.time ) );

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

Sample Output

The time is Wed Feb 13 09:01:26.729 2002

See Also

Time Management Routines | asctime | ctime | gmtime | localtime | time | Run-Time Routines and .NET Framework Equivalents