[man] gettimeofday

숭글·2022년 9월 12일
0

gettimeofday() can get the time as well as a timezone.

#include <sys/time.h>
int gettimeofday(struct timeval restrict tv, struct timezone restrict tz);

-structs

struct timeval {
               time_t      tv_sec;     /* seconds */
               suseconds_t tv_usec;    /* microseconds */
           };
           
struct timezone {
               int tz_minuteswest;     /* minutes west of Greenwich */
               int tz_dsttime;         /* type of DST correction */
           };

If either tv or tz is NULL, the corresponding structure is not returned. (However, compilation warnings will result if tv is NULL.)

RETURN VALUE
-gettimeofday() and settimeofday() return 0 for success. On error, -1 is returned and errno is set to indicate the error.


📖 gettimeofday

profile
Hi!😁 I'm Soongle. Welcome to my Velog!!!

0개의 댓글