\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{uhrzeit}[2016/02/01 v0.2c Uhrzeit-Formate]
\RequirePackage{soul}
%%
%% `uhrzeit.sty'
%% Copyright 2016 Olaf Meltzer
%%
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Olaf Meltzer.
%%
%% This work consists of the files uhrzeit.sty, uhrzeit.tex,
%% and the derived file uhrzeit.pdf.
%%
%%
%% Author: Olaf Meltzer <olaf.meltzer@gmx.de>
%%         
%%         The style uses some ideas, published by
%%         Leif Albers and Andreas Matthias
%%         in de.comp.text.tex
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Automatische Ausgabe der aktuellen Uhrzeit:
%%
%% Befehl   Format
%% ----------------------------------------------
%% \dtd      5.07      (eher ungebr��uchlich)
%% \dtc     05:07      (international)
%% \uhri     5.07 Uhr  (Duden, 22. Aufl., S. 110)
%% \uhrii   05:07 Uhr  (DIN 5008)
%% \uhriii   5^07 Uhr  (ehemals ��blich)
%% \uhriv   05^07 Uhr  (auch ehemals selten gebr��uchlich)
%%
%%
%% Manuelle Eingabe von Uhrzeit oder Uhrzeitbereich
%% im fr��her ��blichen Format:
%%
%% Befehl                  Format
%% -----------------------------------------
%% \uhr{5}{07}             5^07 Uhr
%% \vonbis{5}{07}{13}{45}  5^07 -- 13^45 Uhr
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Die Definition von '\uhr{}{}' stammt weitgehend von
%% "Andreas Matthias" <amat@kabsi.at>
%% in de.comp.text.tex am 24.09.2000
%%
%% Formatiert als '1^05 Uhr'
\newcommand{\uhr}[2]{#1%
 \sbox\z@ T%
 \vbox to\ht\z@{\hbox{\check@mathfonts
 \fontsize\ssf@size\z@
 \math@fontsfalse\selectfont
 \setul{.17em}{.03em}\,\ul{#2}\resetul}%
 \vss}\,Uhr}

%% Formatiert als '1^05 -- 2^15 Uhr'
\newcommand{\vonbis}[4]{#1%
 \sbox\z@ T%
 \vbox to\ht\z@{\hbox{\check@mathfonts
 \fontsize\ssf@size\z@
 \math@fontsfalse\selectfont
 \setul{.17em}{.03em}\,\ul{#2}\resetul}%
 \vss}~--\,#3%
 \sbox\z@ T%
 \vbox to\ht\z@{\hbox{\check@mathfonts
 \fontsize\ssf@size\z@
 \math@fontsfalse\selectfont
 \setul{.17em}{.03em}\,\ul{#4}\resetul}%
 \vss}\,Uhr}

%% Die Definition von \mytime stammt von
%% "Leif Albers" <leif@mathematik.uni-bielefeld.de>
%% und wurde zuerst am 04.10.1999 in de.comp.text.tex gepostet.

% Es wird der TeX-Z��hler \time verwendet, der die Systemzeit
% in "Minuten seit Mitternacht" enth��lt. Ich mache daraus zwei
% Z��hler, \myminutes und \myhours, die die Zeit in "Stunden
% und Minuten seit Mitternacht" enthalten.
\newcount\myhours               % Z��hler (Variable) \myhours Definieren
\newcount\myminutes             % \myminutes Definieren

% Berechnung der Stundenzahl:
% \myhours := \time DIV 60  (Division ohne Rest)
\myhours   = \time
\divide   \myhours by 60

% Berechnung der Minutenzahl:
% \myminutes := \time MOD 60
%             = \time  -  ( \myhours x 60 )
\myminutes = \time
\multiply \myhours by 60        % Zur Berechnung der Minuten wird noch
                                % mal an "\myhours" herumgefummelt
\advance  \myminutes by -\myhours%
\divide   \myhours by 60        % \myhours wiederherstellen

%% Verschiedene Formate f��r die automatische Zeitangabe:

%% International, 1.05 (eher ungebr��uchlich)
\newcommand{\dtd}{\the\myhours.\ifnum\myminutes<10 0\fi\the\myminutes}

%% International, 01:05 (international)
\newcommand{\dtc}{\ifnum\myhours<10 0\fi\the\myhours:%
                 \ifnum\myminutes<10 0\fi\the\myminutes}

%% Deutsch, 1.05~Uhr (Duden)
\newcommand{\uhri}{\the\myhours.\ifnum\myminutes<10 0\fi\the\myminutes\,Uhr}

%% Deutsch, 01:05~Uhr (DIN)
\newcommand{\uhrii}{\ifnum\myhours<10 0\fi\the\myhours:%
                 \ifnum\myminutes<10 0\fi\the\myminutes\,Uhr}

%% Altes Format, 1^05 Uhr (ehemals ��blich)
\newcommand{\uhriii}{\expandafter\uhr{%
   \expandafter\the\myhours}%
  {\expandafter{\expandafter{\ifnum\myminutes<10 0\fi\the\myminutes}}}}

%% Altes Format, 01^05 Uhr (eher ungebr��uchlich)
\newcommand{\uhriv}{\expandafter\uhr{%
   \expandafter{\expandafter{\ifnum\myhours<10 0\fi\the\myhours}}}%
  {\expandafter{\expandafter{\ifnum\myminutes<10 0\fi\the\myminutes}}}}

%% Ende 'uhrzeit.sty'