Borland C++ reference

ftime

raw OCR

Stores current time in timeb structure.

Defined in header <sys/timeb.h>

Syntax

#include <sys\timeb.h>
void ftime(struct timeb *buf)

Portability

DOSUNIXWindowsANSI CC++ only
■■■

Remarks

On UNIX platforms, ftime is only available on System V systems.

ftime determines the current time and fills in the fields in the timeb structure pointed to by buf. The timeb structure contains four fields: time, millitm, timezone, and dstflag:

struct timeb { long time ; short millitm ; short timezone ;

short dstflag ; }; EI time provides the time in seconds since 00:00:00 Greenwich mean time

(GMDJanuary H millitm is the fractional part of a second in milliseconds. □ timezone is the difference in minutes between GMT and the local time.1,1970.

This value is computed going west from GMT. ftime gets this field from the global variable timezone, which is set by tzset. D dstflag is used to indicate whether daylight saving time will be taken into account during time calculations.

^^

ftime calls tzset. Therefore, it isn't necessary to call tzset explicitly when you use ftime.

Retum value

None.

See also

Example

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys\timeb.h>
/* pacific standard & daylight  savings */
char *tzstr = "TZ=PST8PDT";
int main (void)
struct timeb t;
putenv(tzstr) ;
tzset 0;
ftime (&t);
printf ("Seconds since 1/1/1970 GMT: %ld\n", t.time);
printf ("Thousandths of a second: %d\n", t.millitm);
printf ("Difference between local time and GMT: %d\n", t.timezone) ;
printf ("Daylight savings in effect (1) not (0): %d\n", t.dstflag);
return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.