Format
#include <sys\timeb.h> #include <sys\types.h> void _ftime(struct timeb *timeptr);
Language Level: Extension
_ftime gets the current time and stores it in the
structure to which timeptr
points. The <sys\timeb.h> include file contains the
definition of the timeb structure. It contains four fields:
| time | The time in seconds since 00:00:00 Coordinated Universal Time, January 1, 1970. |
| millitm | The fraction of a second, in milliseconds. |
| timezone | The difference in minutes between Coordinated Universal Time and local time, going from east to west. _ftime sets the value of timezone from the value of the global variable _timezone. |
| dstflag | Nonzero if daylight saving time is currently in effect for the local time zone. |
Return Value
There is no return value.
Example
This example polls the system clock,
converts the current time to a character string, prints the
string, and saves the time data in the structure timebuffer.
#include <sys\types.h> #include <sys\timeb.h> #include <stdio.h> #include <time.h>
int main(void)
{
struct timeb timebuffer;
_ftime(&timebuffer);
printf("the time is %s\n", ctime(&(timebuffer.time)));
return 0;
/******************************************************
The output should be similar to:
the time is Thu May 16 16:08:17 1995 ******************************************************/ }
![]()
asctime -- Convert Time to
Character String
ctime -- Convert
Time to Character String
gmtime --
Convert Time
localtime --
Convert Time
mktime --
Convert Local Time
time -- Determine
Current Time
tzset -- Assign
Values to Locale Information
<sys\timeb.h>
<sys\types.h>