Skip to content

Instantly share code, notes, and snippets.

@konn
Last active December 8, 2015 06:09
Show Gist options
  • Save konn/0a230ad9c0a2a6633364 to your computer and use it in GitHub Desktop.
Save konn/0a230ad9c0a2a6633364 to your computer and use it in GitHub Desktop.
研究集会のプログラムを自動でなんかいいかんじにやってくれるやつ
\newcount\kn@timekeeper@min
\kn@timekeeper@min=0
\newcount\kn@timekeeper@hour
\kn@timekeeper@hour=0
\newcount\kn@timekeeper@prvhr
\newcount\kn@timekeeper@prvmin
\def\kn@timekeeper@padtwo#1{\ifnum #1<10 0\fi \the#1\relax}
\def\kn@timekeeper@overflow{
\newcount\kn@timekeeper@overflow@rad
\kn@timekeeper@overflow@rad=\kn@timekeeper@min
\divide \kn@timekeeper@overflow@rad by 60\relax
\global\advance\kn@timekeeper@hour by \kn@timekeeper@overflow@rad\relax
\multiply \kn@timekeeper@overflow@rad by 60\relax
\global\advance\kn@timekeeper@min by -\kn@timekeeper@overflow@rad\relax
\kn@timekeeper@overflow@rad=\kn@timekeeper@hour
\divide\kn@timekeeper@overflow@rad by24
\multiply\kn@timekeeper@overflow@rad by24
\global\advance\kn@timekeeper@hour by -\kn@timekeeper@overflow@rad
}
\def\kn@timekeeper@pprtime#1#2{\kn@timekeeper@padtwo{#1}:\kn@timekeeper@padtwo{#2}}
\def\steptime#1{\kn@timekeeper@prvhr=\kn@timekeeper@hour
\kn@timekeeper@prvmin=\kn@timekeeper@min\relax
\global\advance\kn@timekeeper@min by #1\relax
\kn@timekeeper@overflow
\kn@timekeeper@pprtime{\kn@timekeeper@prvhr}{\kn@timekeeper@prvmin}--\kn@timekeeper@pprtime{\kn@timekeeper@hour}{\kn@timekeeper@min}}
\def\setcurrenttime#1#2{\kn@timekeeper@hour=#1\relax\kn@timekeeper@min=#2\relax}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment