mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
use macro NANOSEC MICROSEC
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NANOSEC 1000000000
|
#define NANOSEC 1000000000
|
||||||
|
#define MICROSEC 1000000
|
||||||
|
|
||||||
static double
|
static double
|
||||||
get_time() {
|
get_time() {
|
||||||
@@ -20,7 +21,7 @@ get_time() {
|
|||||||
int sec = ti.tv_sec & 0xffff;
|
int sec = ti.tv_sec & 0xffff;
|
||||||
int nsec = ti.tv_nsec;
|
int nsec = ti.tv_nsec;
|
||||||
|
|
||||||
return (double)sec + (double)nsec / 1000000000;
|
return (double)sec + (double)nsec / NANOSEC;
|
||||||
#else
|
#else
|
||||||
struct task_thread_times_info aTaskInfo;
|
struct task_thread_times_info aTaskInfo;
|
||||||
mach_msg_type_number_t aTaskInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
|
mach_msg_type_number_t aTaskInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
|
||||||
@@ -29,7 +30,7 @@ get_time() {
|
|||||||
int sec = aTaskInfo.user_time.seconds & 0xffff;
|
int sec = aTaskInfo.user_time.seconds & 0xffff;
|
||||||
int msec = aTaskInfo.user_time.microseconds;
|
int msec = aTaskInfo.user_time.microseconds;
|
||||||
|
|
||||||
return (double)sec + (double)msec / 1000000;
|
return (double)sec + (double)msec / MICROSEC;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user