'StartLogging' Method doesn't include date only time. Is there an option to also print date?

Cause

There are no out-of-the-box solutions from our side.
Our method can not support the record of the date.

Resolution

The custom method can be created and chrono library can be used as in this example:

#include <iostream>
#include <chrono>
#include <ctime>

int main()
{
auto start = std::chrono::system_clock::now();
// Some computation here
auto end = std::chrono::system_clock::now();

std::chrono::duration<double> elapsed_seconds = end-start;
std::time_t end_time = std::chrono::system_clock::to_time_t(end);

std::cout << "finished computation at " << std::ctime(&end_time)
<< "elapsed time: " << elapsed_seconds.count() << "s"
<< std::endl;
}

This should print results in the following format:

finished computation at Mon Oct  2 00:59:08 2017
elapsed time: 1.88232s

Below is an example of using the library with the logging method:

#include <iostream>
#include <ctime>

...

CBstr logFilename;

...

logFilename = CBstr(now->tm_mday) + L"." + CBstr(now->tm_mon + 1) + L"." + CBstr(now->tm_year + 1900) + CBstr(L"_log.txt");
CheckResult(FREngine->StartLogging(logFilename));
CheckResult(frDocument->Process());

...

logFilename = CBstr(now->tm_mday) + L"." + CBstr(now->tm_mon + 1) + L"." + CBstr(now->tm_year + 1900) + CBstr(L"_log.txt");
CheckResult(FREngine->StartLogging(logFilename));
CheckResult(frDocument->Process());





Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.

Recently viewed