Gets the current time.
#include <sys\types.h>
#include <sys\timeb.h>
void _ftime( struct _timeb *timeptr );
timeptr | Pointer to structure defined in SYS\TIMEB.H |
The _ftime function gets the current 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, millitm, time, and timezone), which have the following values:
Field | Value |
dstflag | Nonzero if daylight saving time is currently in effect for the local time zone. (See _tzset for an explanation of how daylight saving time is determined.) |
millitm | Fraction of a second in milliseconds. The last digit is always 0 since millitm is incremented to the nearest one-hundredth of a second. |
time | Time in seconds since midnight (00:00:00), December 31, 1899. |
timezone | Difference in minutes, moving westward, between Universal Coordinated Time and local time. The value of timezone is set from the value of the global variable _timezone (see _tzset). |
The _ftime function gives values to the fields in the structure pointed to by timeptr. It does not return a value.
Standards:None
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:DOS32X
asctime, ctime, gmtime, localtime, time, _tzset
/* 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] );
}
The time is Tue Jun 15 21:40:34.870 1999