(html (head (title "sph-lib (sph time gregorian)") (link (@ (rel "icon") (href "data:,"))) (meta (@ (name "viewport") (content "width=device-width,initial-scale=1"))) (link (@ (rel "stylesheet") (type "text/css") (href "/css/sph.css"))) #f) (body () (div (@ (class top)) (nav (a (@ (href "/")) "start") ", " (a (@ (href "/feed.xml")) "feed")) "") (div (@ (class "middle")) (div (@ (class mtime) (title "last modification time of the current page")) "2025-08-29") (section (h1 "(sph time gregorian)") (div (p "gregorian calendar calculations") (p "part of " (a (@ (href "../../sph-lib.html")) "sph-lib")) ((section (@ (class "library-description")) (h1 "library description") (div (p "uses a year 0 like iso8601. year 0 is a leap year; this simplifies leap-day formulas by making them symmetric for negative and positive years"))) (section (@ (class "library-name")) (h1 "module name") (p "(sph time gregorian)")) (section (@ (class "library-exports")) (h1 "exported bindings") (div (div (@ (class "doc-bindings")) (div (@ (id "doc-b-" "greg-days->leap-days") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-days->leap-days") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer -> integer")) (div (@ (class "description")) (("number of leap days contained in a span of full days." (br) "works with positive and negative spans." (br) "for days < 1 year, checks whether 0-2-29 is included." (br) "for larger spans, uses cycle decomposition symmetrical to the positive case, with century exceptions except multiples of 400")))) (div (@ (id "doc-b-" "greg-days->year") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-days->year") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "greg-days->year-days") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-days->year-days") " " (span (@ (class "first-sig")) "a leap-year? ->")) "" (div (@ (class "description")) (("gives the number of days elapsed in a year. handles negative years/days")))) (div (@ (id "doc-b-" "greg-days->years") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-days->years") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer -> integer")) (div (@ (class "description")) (("the number of years the given number of days fill")))) (div (@ (id "doc-b-" "greg-month->days") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-month->days") " " (span (@ (class "first-sig")) "a leap-year? ->")) (div (@ (class "rest-sig")) (div "integer boolean -> integer")) (div (@ (class "description")) (("gives the number of days needed to reach the first day of the given month." (br) "months are from 1-12")))) (div (@ (id "doc-b-" "greg-month-days") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-month-days")) "" "") (div (@ (id "doc-b-" "greg-month-days-get") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "greg-month-days-get") " " (span (@ (class "first-sig")) "leap-year?")) "" "") (div (@ (id "doc-b-" "greg-month-days-leap-year") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-month-days-leap-year")) "" "") (div (@ (id "doc-b-" "greg-number-of-months") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-number-of-months")) "" "") (div (@ (id "doc-b-" "greg-week-day") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-week-day") " " (span (@ (class "first-sig")) "year month day ->")) (div (@ (class "rest-sig")) (div "integer integer integer -> integer")) (div (@ (class "description")) (("0 being monday")))) (div (@ (id "doc-b-" "greg-year-1970-days") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-year-1970-days")) "" "") (div (@ (id "doc-b-" "greg-year->years") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-year->years") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "greg-year-days") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-year-days")) "" "") (div (@ (id "doc-b-" "greg-year-days->month-and-day&") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-year-days->month-and-day&") " " (span (@ (class "first-sig")) "a greg-month-days c ->")) (div (@ (class "rest-sig")) (div "integer #(days-of-month ...) procedure:{month day -> any} -> any")) (div (@ (class "description")) (("get the month and month day after the given number of days have passed starting from the beginning of the year")))) (div (@ (id "doc-b-" "greg-year-days-leap-year") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-year-days-leap-year")) "" "") (div (@ (id "doc-b-" "greg-year-first-week-day") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-year-first-week-day") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "greg-year-leap-year?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-year-leap-year?") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer:year-number -> boolean")) (div (@ (class "description")) (("check if the given year is a leap year")))) (div (@ (id "doc-b-" "greg-year-weeks-53?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-year-weeks-53?") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer:year-number -> boolean")) (div (@ (class "description")) (("check if the given year number corresponds to a year with 53 instead of 52 weeks according to the iso8601 standard")))) (div (@ (id "doc-b-" "greg-years->days") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-years->days") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer -> integer")) (div (@ (class "description")) (("gives the days contained in given number of fully elapsed years")))) (div (@ (id "doc-b-" "greg-years->leap-days") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-years->leap-days") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer -> integer")) (div (@ (class "description")) (("number of leap days contained in the given count of elapsed years from year 0." (br) "result is nonnegative. for negative elapsed years, the caller subtracts this value." (br) "leap year rule: years divisible by 4 are leap years, including year 0, except centuries not divisible by 400")))) (div (@ (id "doc-b-" "greg-years->year") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-years->year") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer:elapsed-years -> integer:calendar-year")) (div (@ (class "description")) (("maps an elapsed-year count to the corresponding calendar year label." (br) "note: when combined with month/day offsets in negative years, the elapsed-year count may not advance monotonically with the year label")))) (div (@ (id "doc-b-" "sph-time-gregorian-description") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "sph-time-gregorian-description")) "" "")))))))) ()))