A cross platform function to get current time in seconds with precision of micro second double time_in_seconds() {
    std::chrono::time_point&lt;std::chrono::system_clock,std::chrono::microseconds&gt; 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());
    std::time_t time_micro = tmp.count();
    return time_micro / 1000000.0;
}


Here C++11 chrono is used to be able run on multi platform. Use high_resolution_clock to hope to get precision of micro second. std::time_t should be enough to hold this number.
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 '
}