File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414#include <windows.h>
1515#include <sys/timeb.h>
1616#include "pcre/pcre.h"
17+ #elif defined(__linux__ )
18+ #include <sys/time.h>
1719#endif
1820
1921#include "sensors_analytics.h"
2022
21- #define SA_LIB_VERSION "0.1.0 "
23+ #define SA_LIB_VERSION "0.1.1 "
2224#define SA_LIB "C"
2325#define SA_LIB_METHOD "code"
2426
@@ -1265,6 +1267,12 @@ static int _sa_track_internal(
12651267 if (SA_OK != (res = sa_add_int ("time" , (long long )now .time * 1000 + now .millitm , msg ))) {
12661268 return res ;
12671269 }
1270+ #elif defined(__linux__ )
1271+ struct timespec now ;
1272+ clock_gettime (CLOCK_REALTIME , & now );
1273+ if (SA_OK != (res = sa_add_int ("time" , (long long )now .tv_sec * 1000 + now .tv_nsec / 1000000 , msg ))) {
1274+ return res ;
1275+ }
12681276#else
12691277 time_t now = time (NULL );
12701278 if (SA_OK != (res = sa_add_int ("time" , (long long )now * 1000 , msg ))) {
@@ -1332,7 +1340,7 @@ static int _sa_track_internal(
13321340 }
13331341 }
13341342 } else if (NULL != curr -> value -> key && 0 == strncmp ("$project" , curr -> value -> key , 256 )) {
1335- // 若属性中包含 "$project" 对象,则将其改写为project属性
1343+ // 若属性中包含 "$project" 对象,则将其改写为 project 属性.
13361344 SANode * project_node = _sa_get_child ("$project" , properties );
13371345 if (NULL != project_node ) {
13381346 if (SA_OK != (res = sa_add_string (
You can’t perform that action at this time.
0 commit comments