When we put it all together, it boils down to the following:
auto now = boost::chrono::steady_clock::now().time_since_epoch(); auto timeSinceEpoch = boost::chrono::duration_cast<boost::chrono::milliseconds>(now).count();
Suppose itβs not a double , but close enough: you can change the duration_cast to get any precision you need and / or split the timeSinceEpoch to your liking so that your double matches your requirements. For instance:
// Days since epoch, with millisecond (see duration_cast above) precision double daysSinceEpoch = double(timeSinceEpoch) / (24. * 3600. * 1000.);
syam source share