prime_numbers_c/time.h

33 lines
514 B
C
Raw Permalink Normal View History

2021-03-24 15:36:38 +08:00
//
// Created by tursom on 2021/3/24.
//
#ifndef PRIME_NUMBERS_C_TIME_H
#define PRIME_NUMBERS_C_TIME_H
#ifdef _WIN32
#include <Windows.h>
long getCurrentTime() {
LARGE_INTEGER freq;
QueryPerformanceCounter(&freq);
return (long) freq.QuadPart / 10;
}
#else
#include <sys/time.h>
2021-03-24 17:29:51 +08:00
typedef char bool;
bool false = 0;
bool true = 1;
2021-03-24 15:36:38 +08:00
long getCurrentTime() {
struct timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_sec * 1000 * 1000 + tv.tv_usec;
}
#endif
#endif //PRIME_NUMBERS_C_TIME_H