Is there some "standard" way or the best I can do is to compute it directly by subtracting from gregorian::date(1970,1,1)
?
time_t
is the type used to hold time in seconds (typically epoch time). I'm guessing you are after epoch time, if so I'm not aware of any way in boost of actually getting epoch time directly, aside from the subtraction you have already. Once you have a time_duration
(result of the subtraction), you can call total_seconds()
on the duration and store that in time_t
.
btw. if you are after epoch time, you could simple use gettimeofday()
and save yourself some headache!