Back to index

glibc  2.9
Functions
ftime.c File Reference
#include <sys/timeb.h>
#include <sys/time.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int ftime (struct timeb *timebuf)

Function Documentation

int ftime ( struct timeb timebuf)

Definition at line 23 of file ftime.c.

{
  struct timeval tv;
  struct timezone tz;

  if (__gettimeofday (&tv, &tz) < 0)
    return -1;

  timebuf->time = tv.tv_sec;
  timebuf->millitm = (tv.tv_usec + 500) / 1000;
  if (timebuf->millitm == 1000)
    {
      ++timebuf->time;
      timebuf->millitm = 0;
    }
  timebuf->timezone = tz.tz_minuteswest;
  timebuf->dstflag = tz.tz_dsttime;
  return 0;
}