Note. If the calculation is performed rather often, it might be more efficient to create an object epoch of type DATE_TIME with create epoch.make_from_epoch (0) in advance and to use it in the calculation instead:
t.definite_duration (epoch).seconds_count
0
Louis M
On
This seems to work:
make
-- Execute the example
local
l_date:DATE_TIME
l_seconds:INTEGER_64
do
create l_date.make_now
l_seconds := l_date.relative_duration (create {DATE_TIME}.make_from_epoch (0)).seconds_count
print("The number of seconds: " + l_seconds.out + "%N")
end
Assuming variable
t
is of typeDATE_TIME
(in UTC), the code to get the corresponding number of seconds since the epoch isNote. If the calculation is performed rather often, it might be more efficient to create an object
epoch
of typeDATE_TIME
withcreate epoch.make_from_epoch (0)
in advance and to use it in the calculation instead: