Closed JohnEarnest closed 1 month ago
Interesting, and thanks for the report! I'll dig into this in the next week or so.
This behavior is standardized in POSIX.1-2024.
https://www.austingroupbugs.net/view.php?id=983
FYI, date +%s
is also standardized in POSIX.1-2024.
Excellent! Thanks for this fix, Ben!
The POSIX spec for Awk states:
This makes the expression
srand(srand())
a portable (if rather bizarre) idiom for obtaining the current unix epoch in pure Awk.gawk
,mawk
, and the "one-true"awk
support this idiom, butgoawk
does not appear to:I think you would be within your rights to declare supporting this idiom undesirable, but I'm not aware of any alternatives that are fully POSIX-compliant. Shelling out to
date +%s
, for example, might seem reasonable, but%s
as adate
format character does not appear to be guaranteed as of POSIX 1003.1-2017. Thoughts?