Add clock_micros()
This commit is contained in:
@ -19,7 +19,6 @@
|
||||
#include <errno.h>
|
||||
#include <openssl/err.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/time.h>
|
||||
#include <netdb.h>
|
||||
|
||||
static SSL_CTX *proxy_ctx = NULL;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
static const char base64_encode_table[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
@ -203,3 +204,9 @@ int base64_encode(void *data, unsigned long data_len, char *output, unsigned lon
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long clock_micros(void) {
|
||||
struct timespec time;
|
||||
clock_gettime(CLOCK_MONOTONIC, &time);
|
||||
return time.tv_sec * 10000000 + time.tv_nsec / 1000;
|
||||
}
|
||||
|
@ -37,4 +37,6 @@ int str_trim_lws(char **start, char **end);
|
||||
|
||||
int base64_encode(void *data, unsigned long data_len, char *output, unsigned long *output_len);
|
||||
|
||||
long clock_micros(void);
|
||||
|
||||
#endif //SESIMOS_UTILS_H
|
||||
|
Reference in New Issue
Block a user