Skip to content

UNIX_TIME taking too much time#208

Merged
Bruno02468 merged 1 commit intoMystranSolver:devfrom
Bruno02468:unix_time
Apr 8, 2026
Merged

UNIX_TIME taking too much time#208
Bruno02468 merged 1 commit intoMystranSolver:devfrom
Bruno02468:unix_time

Conversation

@Bruno02468
Copy link
Copy Markdown
Collaborator

@Bruno02468 Bruno02468 commented Apr 8, 2026

Fortran does not provide a way to get the current UNIX timestamp. MYSTRAN has a custom subroutine called UNIX_TIME that computes it from DATE_AND_TIME. A thing of beauty, yes, but it is also 500 times slower than C's time().

This update adds .f03 files to the build script, renames UNIX_TIME.f90 to UNIX_TIME.f03 to signal its Fortran 2003-ness, and rewrote UNIX_TIME to use ISO_C_BINDING to call libc's time() function.

Result: the time spent getting the time went from ~15% to nothing.

I don't know how to feel about this. The Fortran 2003 cat is officially out of the bag, though, so that's gotta be good.

Special thanks to @Copper280z for noticing this issue and running the tests!

@Bruno02468 Bruno02468 merged commit 6728ef8 into MystranSolver:dev Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant