gpoore / minted

minted is a LaTeX package that provides syntax highlighting using the Pygments library. Highlighted source code can be customized using fancyvrb.
1.73k stars 125 forks source link

Get full timestamp in XeTeX through \creationdate #395

Closed muzimuzhi closed 3 weeks ago

muzimuzhi commented 1 month ago

Code comment on line 1578 of minted.dtx@1ac8e25e says

Under XeTeX, a derived timestamp (via |\year|, |\month|, |\day|, |\time|) with only minute precision.

Actually XeTeX provides \creationdate since TeX Live 2019, which is equivalent to \pdfcreationdate in pdfTeX.

Since \pdfcreationdate (or its equivalence) is one of the primitives required by l3kernel and l3kernel is bundled in the LaTeX2e format, \creationdate is always available in recent LaTeX2e.

Also the expl3 provides a cross-engine string variable \c_sys_timestamp_str which holds the full timestamp of current job. But it's relatively new (needs l3kernel 2023-08-29).

gpoore commented 3 weeks ago

Thanks for the suggestions! I've switched to \creationdate, and left a note in the code documentation to use \c_sys_timestamp_str once it has been available for longer.