Article View: comp.text.tex
Article #2590Re: A macro for giving the current time of day.
From: David Kastrup
Date: Fri, 21 Aug 1992 09:57
Date: Fri, 21 Aug 1992 09:57
27 lines
1776 bytes
1776 bytes
dfarrow@spam.ua.oz (Duncan Farrow) writes:
>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.
Corrected:
\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
% there is one backslash missing. Besides, why not
\ifnum\time>719\chardef\a=p\else\chardef\a=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:
<dak.714391046@kaa>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!kaa!dakReferences:
<1676@spam.ua.oz>Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!kaa!dak From: dak@kaa.informatik.rwth-aachen.de (David Kastrup) Subject: Re: A macro for giving the current time of day. Message-ID: <dak.714391046@kaa> Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner) Nntp-Posting-Host: kaa Organization: Rechnerbetrieb Informatik / RWTH Aachen References: <1676@spam.ua.oz> Date: 21 Aug 92 09:57:26 GMT Lines: 27