Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with sim_time #90

Closed
mathomp4 opened this issue Apr 7, 2023 · 0 comments
Closed

Bug with sim_time #90

mathomp4 opened this issue Apr 7, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@mathomp4
Copy link
Collaborator

mathomp4 commented Apr 7, 2023

As discovered by @tclune and myself when trying to use the "sim_time" functionality of pflogger, this code:

pFlogger/src/Formatter.F90

Lines 271 to 280 in 6011e59

if(this%fmt_uses_simTime) then
if (allocated(this%datefmt)) then
call get_sim_time(dict)
simtime = FormatString(this%datefmt, dict)
else
simtime = FormatString(DEFAULT_DATE_FMT, dict)
end if
call extra%insert('simtime', String(simtime))
end if

is wrong because if you don't specify a datefmt it will crash because call get_sim_time(dict) is never called.

The possible solution is to move the call above the if-block:

      if(this%fmt_uses_simTime) then
         call get_sim_time(dict)
         if (allocated(this%datefmt)) then
            simtime = FormatString(this%datefmt, dict)
         else
            simtime = FormatString(DEFAULT_DATE_FMT, dict)
         end if
         
         call extra%insert('simtime', String(simtime))
      end if
@mathomp4 mathomp4 added the bug Something isn't working label Apr 7, 2023
@tclune tclune closed this as completed in 99d8446 Apr 13, 2023
tclune added a commit that referenced this issue Apr 13, 2023
…time

Fixes #90 - sim-time with default date format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants