I'm working with a property c++11
library which had its own implementation of Datetime
their implementation can be simplified as a struct that contains the fraction of time up to nanoseconds.
a rough example will look like:
struct custom_time_t {
unsigned year;
unsigned month;
unsigned day;
unsigned hour;
.......
long long nanoseconds;
}
I want to get the epoch
from this custom object but also in nanoseconds resolution - similar to gettimeofday
.
Getting the epoch up to seconds is typical using std::chrono
and std::tm
but how to get the nanoseconds since epoch
as well?