Changeset 1609 for trunk/pdns/pdns/dnsgram.cc
- Timestamp:
- 05/12/10 21:31:27 (3 years ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/dnsgram.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/dnsgram.cc
r1472 r1609 17 17 StatBag S; 18 18 19 struct tm* pdns_localtime_r(const uint32_t* then, struct tm* tm) 20 { 21 time_t t = *then; 22 23 return localtime_r(&t, tm); 24 } 25 19 26 int32_t g_clientQuestions, g_clientResponses, g_serverQuestions, g_serverResponses, g_skipped; 20 struct timeval g_lastanswerTime, g_lastquestionTime;21 void makeReport(const struct timeval& tv)27 struct pdns_timeval g_lastanswerTime, g_lastquestionTime; 28 void makeReport(const struct pdns_timeval& tv) 22 29 { 23 30 int64_t clientdiff = g_clientQuestions - g_clientResponses; … … 26 33 if(clientdiff > 5 && clientdiff > 0.02*g_clientQuestions) { 27 34 char tmp[80]; 28 struct tm tm=* localtime_r(&tv.tv_sec, &tm);35 struct tm tm=*pdns_localtime_r(&tv.tv_sec, &tm); 29 36 strftime(tmp, sizeof(tmp) - 1, "%F %H:%M:%S", &tm); 30 37 … … 32 39 << g_clientQuestions <<" vs " << g_clientResponses << "), diff: " <<clientdiff<<endl; 33 40 34 tm=* localtime_r(&g_lastanswerTime.tv_sec, &tm);41 tm=*pdns_localtime_r(&g_lastanswerTime.tv_sec, &tm); 35 42 strftime(tmp, sizeof(tmp) - 1, "%F %H:%M:%S", &tm); 36 43 37 44 cout<<"Last answer: "<<tmp<<"."<<g_lastanswerTime.tv_usec/1000000.0<<endl; 38 45 39 tm=* localtime_r(&g_lastquestionTime.tv_sec, &tm);46 tm=*pdns_localtime_r(&g_lastquestionTime.tv_sec, &tm); 40 47 strftime(tmp, sizeof(tmp) - 1, "%F %H:%M:%S", &tm); 41 48 … … 45 52 if(serverdiff > 5 && serverdiff > 0.02*g_serverQuestions) { 46 53 char tmp[80]; 47 struct tm tm=* localtime_r(&tv.tv_sec, &tm);54 struct tm tm=*pdns_localtime_r(&tv.tv_sec, &tm); 48 55 strftime(tmp, sizeof(tmp) - 1, "%F %H:%M:%S", &tm); 49 56 … … 51 58 << g_serverQuestions <<" vs " << g_serverResponses << "), diff: " <<serverdiff<<endl; 52 59 53 tm=* localtime_r(&g_lastanswerTime.tv_sec, &tm);60 tm=*pdns_localtime_r(&g_lastanswerTime.tv_sec, &tm); 54 61 strftime(tmp, sizeof(tmp) - 1, "%F %H:%M:%S", &tm); 55 62 56 63 cout<<"Last answer: "<<tmp<<"."<<g_lastanswerTime.tv_usec/1000000.0<<endl; 57 64 58 tm=* localtime_r(&g_lastquestionTime.tv_sec, &tm);65 tm=*pdns_localtime_r(&g_lastquestionTime.tv_sec, &tm); 59 66 strftime(tmp, sizeof(tmp) - 1, "%F %H:%M:%S", &tm); 60 67 … … 89 96 /* report chunked */ 90 97 91 struct timeval lastreport={0, 0};98 struct pdns_timeval lastreport={0, 0}; 92 99 93 100 typedef set<pair<string, uint16_t> > queries_t;