diff options
| author | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2026-01-12 12:56:55 -0500 |
|---|---|---|
| committer | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2026-01-12 12:56:55 -0500 |
| commit | 4d24b34fb7c050c6e68f8ee2e83de9629bcee035 (patch) | |
| tree | cb04c39ec99419349c63415a3ae7f3b696a454d9 | |
| parent | a9485e7458a2f23ee4805d926f45fc4908e3420a (diff) | |
| download | weekschedule-4d24b34fb7c050c6e68f8ee2e83de9629bcee035.tar.gz | |
Support for arbitrary minutes in times
Times will get rounded internally to the nearest
15 minutes for display purposes.
| -rw-r--r-- | weekschedule.cls | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/weekschedule.cls b/weekschedule.cls index abc35be..75925b3 100644 --- a/weekschedule.cls +++ b/weekschedule.cls @@ -135,10 +135,18 @@ % ============================================ % Internal time parsing % ============================================ -% Parse time to decimal (e.g., "9:30" -> 9.5) +% Parse time to decimal and round to nearest 15-minute interval +% (e.g., "9:04" -> 9.0, "9:14" -> 9.25) \def\@parsetime#1{\@@parsetime#1\@nil} \def\@@parsetime#1:#2\@nil{% - \pgfmathparse{#1 + #2/60}% + % Convert to total minutes + \pgfmathparse{#1 * 60 + #2}% + \pgfmathtruncatemacro{\@totalminutes}{\pgfmathresult}% + % Round to nearest 15 minutes + \pgfmathparse{round(\@totalminutes/15)*15}% + \pgfmathtruncatemacro{\@roundedminutes}{\pgfmathresult}% + % Convert back to decimal hours + \pgfmathparse{\@roundedminutes/60}% \edef\@parsedtime{\pgfmathresult}% } |