Article View: comp.text.tex
Article #2579A macro for giving the current time of day.
From: Duncan Farrow
Date: Fri, 21 Aug 1992 05:58
Date: Fri, 21 Aug 1992 05:58
23 lines
1459 bytes
1459 bytes
Dear TeXers, here is a macro for producing the current time (or actually
the time that the macro is called) which behaves very similarly to the
\today macro (The TeXbook, page 406) that returns the current date in
the current font. This macro uses the TeX primative \time that returns
the number of minutes since midnight and most of the effort is spent
in converting this to the hour and minutes past the hour.
\newcount\hour \newcount\minute
\def\now{\ifnum\time<60 %check to see if it's just after midnight
12:\ifnum\time<10 0\fi\number\time am %and act accordingly.
\else
\ifnum\time>719\let\a=p\else\leta=p\fi %Check to see if it is pm
\hour=\time
\divide\hour by 60 %\hour is the result of an integer divide
\ifnum\hour>12\advance\hour by -12\advance\minute by -720\fi
\number\hour:%
\multiply\hour by 60 %Use is made of the integer divide here.
\advance\minute by -\hour
\ifnum\minute<10 0\fi\number\minute\a m\fi}
Well I use it in my draft papers etc.
Duncan.
Technical Details
Message-ID:
<1676@spam.ua.oz>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!spam!dfarrowShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!spam!dfarrow From: dfarrow@spam.ua.oz (Duncan Farrow) Newsgroups: comp.text.tex Subject: A macro for giving the current time of day. Message-ID: <1676@spam.ua.oz> Date: 21 Aug 92 05:58:57 GMT Organization: Stats Pure & Applied Maths, Uni of Adelaide, Australia Lines: 23