Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Nov 1, 2022
1 parent 7fe3c45 commit 710e1d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Logger : public opentelemetry::logs::Logger
# ifdef HAVE_FIELD_TIME
{
auto timeNow = std::chrono::system_clock::now().time_since_epoch();
auto nanos = std::chrono::duration_cast<std::chrono::nanoseconds>(timeNow).count();
auto nanos = std::chrono::duration_cast<std::chrono::nanoseconds>(timeNow).count();
evt[ETW_FIELD_TIME] = utils::formatUtcTimestampNsAsISO8601(nanos);
}
# endif
Expand Down
4 changes: 2 additions & 2 deletions exporters/etw/include/opentelemetry/exporters/etw/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static inline std::string formatUtcTimestampNsAsISO8601(int64_t timestampNs)
char buf[sizeof("YYYY-MM-DDTHH:MM:SS.sssssssssZ") + 1] = {0};
#ifdef _WIN32
__time64_t seconds = static_cast<__time64_t>(timestampNs / NANOSECS_PRECISION);
int nanoseconds = static_cast<int>(timestampNs % NANOSECS_PRECISION);
int nanoseconds = static_cast<int>(timestampNs % NANOSECS_PRECISION);
tm tm;
if (::_gmtime64_s(&tm, &seconds) != 0)
{
Expand All @@ -256,7 +256,7 @@ static inline std::string formatUtcTimestampNsAsISO8601(int64_t timestampNs)
::_snprintf_s(buf, _TRUNCATE, "%04d-%02d-%02dT%02d:%02d:%02d.%09dZ", 1900 + tm.tm_year,
1 + tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, nanoseconds);
#else
time_t seconds = static_cast<time_t>(timestampNs / NANOSECS_PRECISION);
time_t seconds = static_cast<time_t>(timestampNs / NANOSECS_PRECISION);
int nanoseconds = static_cast<int>(timestampNs % NANOSECS_PRECISION);
tm tm;
bool valid = (gmtime_r(&seconds, &tm) != NULL);
Expand Down

0 comments on commit 710e1d8

Please sign in to comment.