www.delorie.com/djgpp/doc/libc/libc_421.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

gettimeofday

Syntax

 
#include <time.h>

int gettimeofday(struct timeval *tp, struct timezone *tzp);

Description

Gets the current GMT time and the local timezone information. The return structures are as follows:

 
struct timeval {
  long tv_sec;  /* seconds since 00:00:00 GMT 1/1/1970 */
  long tv_usec; /* microseconds */
};
struct timezone {
  int tz_minuteswest; /* west of GMT */
  int tz_dsttime;     /* set if daylight saving time in affect */
};

If either tp or tzp are NULL, that information is not provided.

Note that although this function returns microseconds for compatibility reasons, the values are precise to less than 1/20 of a second only. The underlying DOS function has 1/20 second granularity, as it is calculated from the 55 ms timer tick count, so you won't get better than that with gettimeofday().

See section settimeofday.

Return Value

Zero on success, nonzero on failure.

Portability

ANSI/ISO C No
POSIX No


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004