I have a function from a library i'm using that requires a double as a parameter. It needs to be passed an offset of type nanoseconds plus the sytem_clock::now(). I have this code so far:
system_clock::time_point now = std::chrono::system_clock::now();
auto timepointoffset = (now + desiredOffset);
How can I make this a double?
Edit: So I need to add that the problem is that I need to do it without a risk of losing data. I have this code:
system_clock::time_point now = std::chrono::system_clock::now();
auto timepointoffset = std::chrono::time_point_cast<std::chrono::nanoseconds>(now + desiredOffset);
double value = timepointoffset.time_since_epoch().count();
The problem is that the compiler says that there is a possible loss of data.