[OS X TeX] datetime (include time source file was last modified)
Peter Dyballa
Peter_Dyballa at Web.DE
Thu Jul 13 16:20:40 CEST 2006
Am 13.07.2006 um 03:55 schrieb Jan Anderssen:
>> Dear: Whoever, (Knowledgable Ones)
>
> On a related note, does anyone know of an (easy?) way to include
> the date/time when source file was last modified, rather than the
> last compile time? ("last modified" turned out not to be the most
> helpful search string :))
>
Here is a "luxury" block Heiko Oberdiek sent five or six weeks ago
(eTeX and pdfTeX >= 1.30.0):
\documentclass{article}
\usepackage{ngerman}
\usepackage{hyperref}
\makeatletter
\@ifundefined{pdffilemoddate}{%
\PackageError{sourcetime}{%
pdfTeX >= 1.30.0 required%
}%
\let\pdffilemoddate\@gobble
}{}%
\newcommand*{\SourceFile}[1]{%
\edef\@SourceFileDate{\pdffilemoddate{#1}}%
% empty in case of errors, but don't harm in next comparison
\ifnum\pdfstrcmp{\@SourceFileDate}{\@CurrentSourceFileDate}>0 %
\let\@CurrentSourceFileDate\@SourceFileDate
\expandafter\@ParseDate\@SourceFileDate\@nil
\hypersetup{%
pdfcreationdate={\@SourceFileDate},%
pdfmoddate={\@SourceFileDate}%
}%
\PackageInfo{sourcetime}{%
Using file `#1'%
}%
\fi
}
\newcommand*{\@CurrentSourceFileDate}{}
\expandafter\def\expandafter\@ParseDate\detokenize{D:}
#1#2#3#4#5#6#7#8{%
\year=#1#2#3#4\relax
\month=#5#6\relax
\day=#7#8\relax
\@ParseTime
}
\def\@ParseTime #1#2#3#4#5\@nil{%
\time=\numexpr #1#2 * 60 + #3#4\relax
}
\makeatother
\SourceFile{tx.pdf}
\SourceFile{Zip.java}
\begin{document}
J"ungste Quelle: \today.
\end{document}
It is merely meant to create a date format like "D:20060605220539
+'02'00" for use in hypersetup as file date, but it might be useful
for your purpose, too.
--
Greetings
Pete
Increase the size of your bike by at least *five* inches!
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
More information about the macostex-archives
mailing list