1. gettimeofday(Linux和MacOS支持) ```c

    include

// prototypes: // int gettimeofday (struct timeval restrict tv, void restrict tz)

uint64_t msSinceEpoch() { struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec * 1000 + tv.tv_usec / 1000; }

  1. 2. time(NULL) c标准
  2. ```c
  3. #include <time.h>
  4. // prototypes:
  5. // time_t time (time_t *__timer)
  6. void test() {
  7. time_t t = time(NULL);
  8. time_t t2;
  9. time(&t2);
  10. }