I have a fortran 90 function that is meant to parse a time stamp in the form day as %Y%m%d.%f where %f is fraction of a day /48 and return an array with year, month, day, fraction of day.
function parseTimeStamp (timeStamp)
implicit none
real, dimension(5) :: parseTimeStamp
real, intent(in) :: timeStamp
real :: date, moment
integer :: intdate, day, month, year, t
date = floor(timeStamp) ! remove the part days
parseTimeStamp(4) = timeStamp - date ! save the part days
intdate = int(date)
day = mod(intdate,100); intdate = intdate / 100
month = mod(intdate,100); intdate = intdate / 100
year = intdate
parseTimeStamp(1) = real(year)
parseTimeStamp(2) = real(month)
parseTimeStamp(3) = real(day)
end function parseTimeStamp
The issue is the output shows fraction of the day always at 0. When printing the timestamp (!print *, timeStamp) I get the date without fraction of the day 48 times before rolling over to the next day, even when I know with 100% certainty the data being read contains the proper fraction.
ex: I am getting
20220101.0 20220101.0 20220101.0 .... 20220102.0 20220102.0 ...
instead of
20220101.0 20220101.02083 20220101.04167 .... 20220102.0 20220102.02083 ...
I've tried using several different input files and have confirmed that the input files contain the part day data.