This subroutine writes the value of a time-type parameter to a log file, along with its name and the module it came from.
1424 type(param_file_type),
intent(in) :: cs
1425 character(len=*),
intent(in) :: modulename
1426 character(len=*),
intent(in) :: varname
1427 type(time_type),
intent(in) :: value
1428 character(len=*),
optional,
intent(in) :: desc, units
1429 type(time_type),
optional,
intent(in) :: default
1430 real,
optional,
intent(in) :: timeunit
1431 logical,
optional,
intent(in) :: log_date
1432 logical,
optional,
intent(in) :: layoutparam
1434 real :: real_time, real_default
1435 logical :: use_timeunit, date_format
1436 character(len=240) :: mesg, myunits
1437 character(len=80) :: date_string, default_string
1438 integer :: days, secs, ticks, ticks_per_sec
1440 use_timeunit = .false.
1441 date_format = .false. ;
if (
present(log_date)) date_format = log_date
1443 call get_time(
value, secs, days, ticks)
1445 if (ticks == 0)
then 1446 write(mesg,
'(" ",a," ",a," (Time): ",i0,":",i0)') trim(modulename), &
1447 trim(varname), days, secs
1449 write(mesg,
'(" ",a," ",a," (Time): ",i0,":",i0,":",i0)') trim(modulename), &
1450 trim(varname), days, secs, ticks
1452 if (is_root_pe())
then 1453 if (cs%log_open)
write(cs%stdlog,
'(a)') trim(mesg)
1454 if (cs%log_to_stdout)
write(cs%stdout,
'(a)') trim(mesg)
1457 if (
present(desc))
then 1458 if (
present(timeunit)) use_timeunit = (timeunit > 0.0)
1459 if (date_format)
then 1462 date_string = convert_date_to_string(
value)
1463 if (
present(default))
then 1464 default_string = convert_date_to_string(default)
1465 call doc_param(cs%doc, varname, desc, myunits, date_string, &
1466 default=default_string, layoutparam=layoutparam)
1468 call doc_param(cs%doc, varname, desc, myunits, date_string, &
1469 layoutparam=layoutparam)
1471 elseif (use_timeunit)
then 1472 if (
present(units))
then 1473 write(myunits(1:240),
'(A)') trim(units)
1475 if (abs(timeunit-1.0) < 0.01)
then ; myunits =
"seconds" 1476 elseif (abs(timeunit-3600.0) < 1.0)
then ; myunits =
"hours" 1477 elseif (abs(timeunit-86400.0) < 1.0)
then ; myunits =
"days" 1478 elseif (abs(timeunit-3.1e7) < 1.0e6)
then ; myunits =
"years" 1479 else ;
write(myunits,
'(es8.2," sec")') timeunit ;
endif 1481 real_time = (86400.0/timeunit)*days + secs/timeunit
1482 if (ticks > 0) real_time = real_time + &
1483 real(ticks) / (timeunit*get_ticks_per_second())
1484 if (
present(default))
then 1485 call get_time(default, secs, days, ticks)
1486 real_default = (86400.0/timeunit)*days + secs/timeunit
1487 if (ticks > 0) real_default = real_default + &
1488 real(ticks) / (timeunit*get_ticks_per_second())
1489 call doc_param(cs%doc, varname, desc, myunits, real_time, real_default)
1491 call doc_param(cs%doc, varname, desc, myunits, real_time)
1494 myunits=
'not defined';
if (
present(units))
write(myunits(1:240),
'(A)') trim(units)
1495 call doc_param(cs%doc, varname, desc, myunits,
value, default)