add sigar_time_now_millis util
This commit is contained in:
parent
1283315dfc
commit
15f7996b8a
|
@ -117,6 +117,7 @@
|
|||
#endif
|
||||
|
||||
#define SIGAR_MSEC 1000L
|
||||
#define SIGAR_USEC 1000000L
|
||||
#define SIGAR_NSEC 1000000000L
|
||||
|
||||
#define SIGAR_SEC2NANO(s) \
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
#define PROCP_FS_ROOT "/proc/"
|
||||
#endif
|
||||
|
||||
sigar_int64_t sigar_time_now_millis(void);
|
||||
|
||||
char *sigar_uitoa(char *buf, unsigned int n, int *len);
|
||||
|
||||
int sigar_inet_ntoa(sigar_t *sigar,
|
||||
|
|
|
@ -812,3 +812,13 @@ SIGAR_DECLARE(void) sigar_log_impl_file(sigar_t *sigar, void *data,
|
|||
FILE *fp = (FILE*)data;
|
||||
fprintf(fp, "[%s] %s\n", log_levels[level], message);
|
||||
}
|
||||
|
||||
sigar_int64_t sigar_time_now_millis(void)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#else
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
return ((tv.tv_sec * SIGAR_USEC) + tv.tv_usec) / SIGAR_MSEC;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue