Skip to content

Instantly share code, notes, and snippets.

@mironovdm
Last active April 11, 2021 11:10
Show Gist options
  • Save mironovdm/e37433fb1bdd14641e2e49778f05aad5 to your computer and use it in GitHub Desktop.
Save mironovdm/e37433fb1bdd14641e2e49778f05aad5 to your computer and use it in GitHub Desktop.
С datetime functions

<sys/time.h>

int gettimeofday(struct timeval *restrict tv, struct timezone *restrict tz);

<time.h>

int clock_gettime(clockid_t clockid, struct timespec *tp);
int timespec_get(struct timespec *ts, int base);

base: TIME_UTC

Datetime Structures

struct timespec {
  time_t   tv_sec;        /* seconds */
  long     tv_nsec;       /* nanoseconds */
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment