Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ftime, ftime64 - get date and time

&pagelevel(4)&pagelevel

Syntax

#include <sys/timeb.h>

int ftime(struct timeb *tp);
int ftime64(struct timeb64 *tp);

Description

ftime() enters in the structure pointed to by tp the exact time in milliseconds since January 1, 1970, 00:00:00 UTC (Universal Time Coordinated).
As of 19.1.2038 03:14:08 hrs UTC ftime() outputs the message CCM0014 and ends the program.

The ftime64() function behaves like ftime() with the difference that it also returns
correct results after 19.1.2038 03:14:07 hrs.

tp is a pointer to a structure that is defined in sys/timeb.h as follows.

struct timeb {
   time_t time;              /* Share of seconds      */ 
   unsigned short millitim;  /* Share of milliseconds */ 
   short timezone;           /* Not supported         */
   short dstflag;            /* Not supported         */
}; 

or

struct timeb64 { 
   time64_t time; 
   unsigned short millitm; 
   short timezone; 
   short dstflag; 
   short filler; 
}; 

The timezone and dstflag values are always zero. In other words, ftime() cannot be
used to determine the local time zone and the setting for daylight saving time.

BS2000
ftime() returns, in a structure, the same time as time (current local time as the number
of seconds elapsed since January 1, 1970 00:00:00 local time) and also includes milliseconds.

For portability reasons, additional options have been included in the structures timeb and
timeb64 . However, they are not supplied in the BS2000 environment. (End)

Return val.

0                       always.

Notes

Depending on the resolution of the system clock, as a rule the value in millitim is not
accurate to the last millisecond. Applications that depend on a particular level of precision
in millitim are therefore not portable.

ftime() cannot be used together with the external variable timezone in a source file.

The variable _TIMEZONE_STRUCT must be set by means of a DEFINE at compilation.

BS2000

The memory space for the result structure must be supplied explicitly!

The type time_t is defined in sys/types.h.

From the following structure components, only the time and millitim components are provided with values in the BS2000 environment. The other components are included in the structure only for portability reasons:

time:

Time in seconds since January 1, 1950 00:00:00

millitim:

Specification in milliseconds (0 to 999) to increase the precision of

time.

timezone:

Local time zone, measured in minutes west of Greenwich (not
supported).

dstflag:

Flag for daylight saving time (not supported). (End)

See also

ctime(), gettimeofday(), time(), sys/timeb.h.