logging and add DST awareness to timestamps

This commit is contained in:
Jeff 2018-10-02 11:29:37 -04:00
parent f3d446dafb
commit 77b2903bda
2 changed files with 12 additions and 2 deletions

View File

@ -1012,6 +1012,7 @@ namespace llarp
else else
{ {
// no path? // no path?
llarp::LogError("no path");
return false; return false;
} }
} }
@ -1030,6 +1031,7 @@ namespace llarp
} }
++itr; ++itr;
} }
llarp::LogWarn("No path ready to send yet");
// all paths are not ready? // all paths are not ready?
return false; return false;
} }

View File

@ -6,7 +6,11 @@ llarp_time_t
llarp_time_now_ms() llarp_time_now_ms()
{ {
struct timeval tv; struct timeval tv;
gettimeofday(&tv, nullptr); struct timezone z;
z.tz_minuteswest = 0;
time_t t = time(nullptr);
z.tz_dsttime = gmtime(&t)->tm_isdst;
gettimeofday(&tv, &z);
llarp_time_t timeNow = llarp_time_t timeNow =
(llarp_time_t)(tv.tv_sec) * 1000 + (llarp_time_t)(tv.tv_usec) / 1000; (llarp_time_t)(tv.tv_sec) * 1000 + (llarp_time_t)(tv.tv_usec) / 1000;
return timeNow; return timeNow;
@ -16,7 +20,11 @@ llarp_seconds_t
llarp_time_now_sec() llarp_time_now_sec()
{ {
struct timeval tv; struct timeval tv;
gettimeofday(&tv, nullptr); struct timezone z;
z.tz_minuteswest = 0;
time_t t = time(nullptr);
z.tz_dsttime = gmtime(&t)->tm_isdst;
gettimeofday(&tv, &z);
llarp_time_t timeNow = tv.tv_sec; llarp_time_t timeNow = tv.tv_sec;
return timeNow; return timeNow;
} }