Created
May 7, 2020 03:10
-
-
Save neatlife/8dfa720d950da206a18a268349e5054f to your computer and use it in GitHub Desktop.
c get current second
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static long long epochms(void) | |
{ | |
struct timespec tv; | |
clock_gettime(CLOCK_REALTIME, &tv); | |
return tv.tv_sec; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static long long epochms(void) | |
{ | |
struct timespec tv; | |
clock_gettime(CLOCK_REALTIME, &tv); | |
return tv.tv_sec * 1000ULL + tv.tv_nsec / 1000000ULL; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment