summaryrefslogtreecommitdiff
path: root/macros/generic/misc/daytime.sty
blob: cfeeafb205b1ab7d0ccea91a9f4a55269293179f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
%% Save file as: DAYTIME.STY            Source: FILESERV@SHSU.BITNET  
%% Source: INFO-TeX@SHSU.edu (Wed, 2 Oct 1991 10:01:43 EDT)
%% Author: Mauro Orlandini <ORLANDINI@HEAVAX.GSFC.NASA.GOV>
%% Modified: George D. Greenwade <bed_gdg@SHSU.edu> -- added \Daytime
%%           to not have the leading 0 on 1:00 --- 9:00
\begingroup
    \count0=\time
    \count1=\count0
    \divide\count0 by 60
    \count2=\count0
    \multiply\count0 by 60
    \advance\count1 by -\count0
    \ifnum\count2>11
         \ifnum\count2>12 \advance\count2 by -12\fi
         \def\ampm{pm}%
    \else
         \ifnum\count2=0 \advance\count2 by 12\fi
         \def\ampm{am}%
    \fi
    \xdef\daytime{%
         \ifnum\count2<10 0\fi \the\count2:%
         \ifnum\count1<10 0\fi \the\count1
         \ampm
    }%
    \xdef\Daytime{%                          %GDG
         \the\count2:%                       %GDG
         \ifnum\count1<10 0\fi \the\count1   %GDG
         \ampm                               %GDG
    }%                                       %GDG
\endgroup