_ftime
Gets the current time.
void_ftime(struct_timeb*timeptr);
Function | Required Header | Compatibility |
_ftime | <sys/types.h> and <sys/timeb.h> | Win 95, Win NT |
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB | Single thread static library, retail version |
LIBCMT.LIB | Multithread static library, retail version |
MSVCRT.LIB | Import library for MSVCRT.DLL, retail version |
Return Value
_ftime does not return a value, but fills in the fields of the structure pointed to by timeptr.
Parameter
timeptr
Pointer to _timeb structure
Remarks
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:
dstflag
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.)
millitm
Fraction of a second in milliseconds.
time
Time in seconds since midnight (00:00:00), January 1, 1970, coordinated universal time (UTC).
timezone
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).
Example
/* 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>
void main( void )
{
struct _timeb timebuffer;
char *timeline;
_ftime( &timebuffer );
timeline = ctime( & ( timebuffer.time ) );
printf( "The time is %.19s.%hu %s", timeline, timebuffer.millitm, &timeline[20] );
}
Output
The time is Tue Mar 21 15:26:41.341 1995