% timestamp.sty % for printing timestamps in LaTeX % Christopher M. Lott % with much help from others, as shown below % 8 March 94 % % The timestamp macro is defined purely in terms of other macros, % making extensions for other languages reasonably simple. % English, German, and French variants are supplied. % % The code for weekday may break in 2000; I don't understand it % well enough to repair it. % % % This file defines the following macros: % % \nowtwelve -- prints 8:15 A.M., 2:45 P.M., etc. % \nowtwentyfour -- prints 08:15, 14:45, etc. % \now -- same as \nowtwelve by default. % % \weekdayenglish{yyyy}{mm}{dd} -- prints Monday, Tuesday, etc. % \weekdaygerman{yyyy}{mm}{dd} -- prints Montag, Dienstag, usw. % \weekdayfrench{yyyy}{mm}{dd} -- prints lundi, mardi, etc. % \weekday{yyyy}{mm}{dd} -- same as \weekdayenglish by default % % \timestamptwelve -- prints 8:15 A.M., Tuesday, March 8, 1994 % \timestamptwentyfour -- prints 08:15, Tuesday, March 8, 1994 % \timestampgerman -- prints 08:15, Dienstag, den 8. Maerz 1994 % \timestampfrench -- prints 08:15, mardi, 8. mars 1994 % \timestampenglish -- same as \timestamptwelve by default % \timestamp -- same as \timestamptwelve by default. % %%%%%%%%%%%%%%%%%%%% start of time code %%%%%%%%%%%%%%%%%%%% % % Code for printing the time by Michael Doob % kindly sent to me on 7 March 94 % only requires new counters \hour and \minute % \newcount\hour \newcount\minute \hour=\time \divide \hour by 60 \minute=\time \loop \ifnum \minute > 59 \advance \minute by -60 \repeat \def\nowtwelve{\ifnum \hour<13 \number\hour:% % supresses leading 0's \ifnum \minute<10 0\fi% % so add it it \number\minute \ifnum \hour<12 \ A.M.\else \ P.M.\fi \else \advance \hour by -12 \number\hour:% % supresses leading 0's \ifnum \minute<10 0\fi% % add it in \number\minute \ P.M.\fi} \def\nowtwentyfour{\ifnum \hour<10 0\fi% % need a leading 0 \number\hour:% % supresses leading 0's \ifnum \minute<10 0\fi% % add it in \number\minute} \def\now{\nowtwelve} %%%%%%%%%%%%%%%%%%%% end of time code %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% start of weekday code %%%%%%%%%%%%%%%%%%%% % % Code for computing the day of the week by: % original source: Dimitri Vulis % modifications by George D. Greenwade % assistance from Bernhard Schroeder % and Hunter Goatley % 21-FEB-1991 17:42:37 % % Usage: \weekday{yyyy}{mm}{dd} (where "yyyy" is a year, "mm" is the numeric % equilavent of the month, and "dd" is the specific calendar date % which may be one or two numbers) yields the weekday associated with % the date provided (i.e., Sunday, Monday, ...). May pass \year, % \month, and \day to generate today's weekday. % \newcount\wwwy \newcount\wwwm \newcount\wwwd \newcount\wwwc \newcount\wwwt \newcount\wwws % compute the weekday \def\weekday@{% suppress the blank before the day \wwwc=\wwwy \divide\wwwc100\relax \wwwt=-\wwwc \multiply\wwwt100\relax \advance\wwwy\wwwt \wwws=\wwwy \multiply\wwws1461\relax \divide\wwws4\relax \wwwt=\wwwm \multiply\wwwt764\relax \divide\wwwt25\relax \advance\wwws\wwwt \advance\wwws\wwwd \ifnum\wwwm>\tw@\advance\wwws\thr@@\else\weekday@@\fi \wwwt=-\wwws \divide\wwwt7\relax \multiply\wwwt7\relax \advance\wwws\wwwt } % By the year 2000 we ought to examine \wwwc as well \def\weekday@@{% \wwwt=\wwwy \divide\wwwt4\relax \multiply\wwwt4\relax \advance\wwwt-\wwwy \ifnum\wwwt=\z@\advance\wwws4\else\advance\wwws5\if} \def\weekdayenglish#1#2#3{% year, month 1--12, day 1--31 \wwwy=#1\relax\wwwm=#2\relax\wwwd=#3\relax\weekday@ \ifcase\wwws Sunday\or Monday\or Tuesday\or Wednesday\or Thursday\or Friday\or Saturday\fi} \def\weekdaygerman#1#2#3{% year, month 1--12, day 1--31 \wwwy=#1\relax\wwwm=#2\relax\wwwd=#3\relax\weekday@ \ifcase\wwws Sonntag\or Montag\or Dienstag\or Mittwoch\or Donnerstag\or Freitag\or Samstag\fi} \def\weekdayfrench#1#2#3{% year, month 1--12, day 1--31 \wwwy=#1\relax\wwwm=#2\relax\wwwd=#3\relax\weekday@ \ifcase\wwws dimanche\or lundi\or mardi\or mercredi\or jeudi\or vendredi\or samedi\fi} \def\weekday#1#2#3{\weekdayenglish{#1}{#2}{#3}} %%%%%%%%%%%%%%%%%%%% end of weekday code %%%%%%%%%%%%%%%%%%%% % % finally define the timestamp macros and the defaults % \def\timestamptwelve{\nowtwelve,\ \weekday{\year}{\month}{\day},\ \today} \def\timestamptwentyfour{\nowtwentyfour,\ \weekday{\year}{\month}{\day},\ \today} \def\timestampgerman{\nowtwentyfour,\ \weekdaygerman{\year}{\month}{\day},\ den \today} \def\timestampfrench{\nowtwentyfour,\ \weekdayfrench{\year}{\month}{\day},\ \today} \def\timestampenglish{\timestamptwelve} \def\timestamp{\timestamptwelve} % end of timestamp.sty -- "Christopher Lott / Email: lott@informatik.uni-kl.de / Tel: +49 (631) 205-3334" "Adresse: FB Informatik - Bau 57 / Universitaet KL / D--67653 Kaiserslautern"