blob: 667cce64841b24d346edb1a41c1f2e306b00a223 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% File: clock.tex
% Date: April 10, 2001
% Author: Oliver Corff
% (c) 2001 Ulaanbaatar, Macau, Berlin
%
% A package for providing graphical
% clocks to TeX- and LaTeX-users.
%
% Usage: \input clock
%
% No options.
%
% NB: This file does not require LaTeX2e!
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Size definitions
%
\ifx\LaTeXclock\undefined
\font\myclockfont clock
\font\mybigclockfont clock at 24pt
%
\def\clockfont{\let\clockfont\myclockfont}
\def\bigclockfont{\let\clockfont\mybigclockfont}
\fi
\ifx\TeXclock\undefined
\def\TeXclock{}
\catcode`@ 11
\else
\endinput
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Variables
%
\newcount\time@in@minutes
\newcount\floor@minutes
\newcount\hour@minutes
\newcount\text@hours
\newcount\text@minutes
\newcount\my@minute
\newcount\my@minutes
\newcount\my@hour
\newcount\ClockStyle % one of 1 2 3 4
\global\newif\ifClockFrame % one of true false
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Time Calculations
%
\def\calc@hours{%
\time@in@minutes=\time
\text@hours=\time@in@minutes
\divide\text@hours by 60 }
\def\texthours{%
\calc@hours
\the\text@hours }
\def\calc@minutes{%
\calc@hours
\floor@minutes=\text@hours
\multiply\floor@minutes by 60
\text@minutes=\time@in@minutes
\advance\text@minutes-\floor@minutes }
\def\textminutes{%
\calc@minutes
\ifnum\text@minutes<10 0\fi
\the\text@minutes}
\def\texttime{\texthours:\textminutes}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Display Operations
%
\def\show@clock#1#2{%
{\clockfont %
\char#1\kern-1.00ex \char#2% % Print hours and minutes!
\advance\ClockStyle by 48 % Build dial
\ifnum\ClockStyle>48
\kern-1ex\char\ClockStyle %
\fi
\ifClockFrame \kern-1ex\char48 \fi
}}
\def\calc@movement{%
\ifnum\my@hour>11 \advance\my@hour by -12 \fi
\multiply\my@hour by 5
\my@minutes=\my@minute
\divide\my@minutes by 12
\advance\my@hour by \my@minutes
\advance\my@hour by 128
\advance \my@minute by 64
}
\def\clock#1#2{%
\my@hour#1\my@minute#2%
\calc@movement
\show@clock{\my@hour}{\my@minute}}
\def\clocktime{%
\calc@minutes % Calls \calc@hours
\clock{\text@hours}{\text@minutes}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Initial Settings
%
\ClockStyle=1
\ClockFramefalse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Some Housekeeping...
%
\ifx\LaTeXclock\undefined
\catcode`@ 12
\fi
|