MCPcopy Create free account
hub / github.com/GPUOpen-Tools/radeon_gpu_analyzer / ConstructDateTimeString

Method ConstructDateTimeString

source/common/rg_log.h:469–488  ·  view source on GitHub ↗

Constructs a string that contains current date & time in the format: "YYYYMMDD-HHMMSS"

Source from the content-addressed store, hash-verified

467
468 // Constructs a string that contains current date & time in the format: "YYYYMMDD-HHMMSS"
469 static std::string ConstructDateTimeString()
470 {
471 time_t current_time = time(0);
472 std::stringstream s;
473 bool success = false;
474#ifdef _WIN32
475 struct tm tt;
476 struct tm* pT = &tt;
477 success = (localtime_s(&tt, &current_time) == 0);
478#else
479 struct tm* pT = localtime(&current_time);
480 success = (pT != nullptr);
481#endif
482 if (success)
483 {
484 s << std::to_string(pT->tm_year + 1900) << std::to_string(pT->tm_mon + 1) << std::to_string(pT->tm_mday) <<
485 "-" << std::to_string(pT->tm_hour) << std::to_string(pT->tm_min) << std::to_string(pT->tm_sec);
486 }
487 return s.str();
488 }
489
490 // Checks if a message should be processed based on provided message level and current log file level.
491 template<LogDst DST>

Callers

nothing calls this directly

Calls 1

strMethod · 0.80

Tested by

no test coverage detected