d2u(3f) - [M_time] given DAT date-time array returns Unix Epoch Time (UET starts at 0000 on 1 Jan. 1970, UTC) (LICENSE:PD)
Synopsis
Description
Options
Returns
Example
Author
License
function d2u(dat) result (unixtime)integer,intent(in),optional :: dat(8) real(kind=realtime) :: unixtime
Converts a DAT date-time array to a Unix Epoch Time value. Typically mathematical operations such as sums, sorting and comparison are performed with simple UET numeric values, and then they are converted back.
dat Integer array holding a "DAT" array, similar in structure to the array returned by the intrinsic DATE_AND_TIME(3f): dat=[year,month,day,timezone,hour,minutes,seconds,milliseconds]
If not present the current time is used
unixtime The "Unix Epoch" time, or the number of seconds since 00:00:00 on January 1st, 1970, UTC.
Sample program:
program demo_d2u use M_time, only : d2u implicit none integer :: dat(8) call date_and_time(values=dat) write(*,(" Today is:",*(i0:,":")))dat write(*,*)Unix Epoch time is ,d2u(dat) end program demo_d2uresults:
Today is:2016:7:19:-240:2:0:48:561 Unix Epoch time is 1468908048.5610321
John S. Urban, 2015
Public Domain
d2u (3) | July 05, 2020 |