A cross platform function to get current time in seconds with precision of micro second
Leveraging the standard library is the best way to obtain cross-platform code, so you're on the right track. The problem is that your doesn't compile with one of the compilers I've tested it with (clang 8). Using auto would make your code simpler and avoid problematic conversions:

double time_in_seconds() {
    // now compiles with both clang 8 and gcc 9
    auto tp = std::chrono::time_point_cast&lt;std::chrono::microseconds&gt;(std::chrono::high_resolution_clock::now());
    auto tmp = std::chrono::duration_cast&lt;std::chrono::microseconds&gt;(tp.time_since_epoch());
    auto time_micro = tmp.count();
    return time_micro / 1000000.0;
}


Besides, there is no need for those intermediary, ill-named variables tp and tmp. If your function is contained in an implementation file (.cpp), where it should be, importing the std::chrono namespace is perfectly fine, and it becomes quite readable:

double time_in_seconds() {
    using namespace std::chrono;
    return duration_cast&lt;microseconds&gt;(system_clock::now().time_since_epoch()).count() / 1000000.0;
}


auto would also be a better choice for the return type:

auto time_in_seconds() {
    using namespace std::chrono;
    return duration_cast&lt;microseconds&gt;(system_clock::now().time_since_epoch()).count()
           / 1000000.0l; // long double literal
}


auto here avoids any discrepancy between the promotion done in the arithmetic operation (the division by 1.000.000) and the promotion to the return type. For instance:

long double foo() { // seemingly long double precision
    return some_integer / 100.01f; // actually float precision
}


A last improvement I think of is the use of enhanced literals:

auto time_in_seconds() {
    using namespace std::chrono;
    return duration_cast&lt;microseconds&gt;(system_clock::now().time_since_epoch()).count() 
           / 1'000'000.0l; // you can separate thousands with '
}