%%% leap year?
\newif\if@leapyear\@leapyearfalse
\newcount\tmptmp@a\newcount\tmptmp@b
\tmptmp@a=\the@yearcode\tmptmp@b=\the@yearcode
%% if ( year mod 4 == 0 ) then leap year true
\divide\tmptmp@a4
\multiply\tmptmp@a4
\advance\tmptmp@b-\tmptmp@a
\ifnum\tmptmp@b=0
\@leapyeartrue
\else
\@leapyearfalse
\fi
\if@leapyear
%% if ( year mod 4 == 0 ) and ( year mod 100 == 0 ) then leap year false
\tmptmp@a=\the@yearcode\tmptmp@b=\the@yearcode
\divide\tmptmp@a100
\multiply\tmptmp@a100
\advance\tmptmp@b-\tmptmp@a
\ifnum\tmptmp@b=0
\@leapyearfalse
\fi
%% but ( year mod 4 == 0 ) and ( year mod 100 == 0 ) and ( year mod 400 == 0 )
%% then leap year true
\tmptmp@a=\the@yearcode\tmptmp@b=\the@yearcode
\divide\tmptmp@a400
\multiply\tmptmp@a400
\advance\tmptmp@b-\tmptmp@a
\ifnum\tmptmp@b=0
\@leapyeartrue
\fi
\fi