modus
Menu
On this page

The module calendar

The days of the months of the Gregorian calendar.

This version has a fault: it forgets the rule of the 400 years, so the year 2000 has 365 days and February 2000 has 28. The module calendar_fixed corrects it with the same description of each export: the system can give calendar_fixed to each module that imports this one.

What it is for. It is the module with a fault that the replacement of an import corrects. agenda imports it; the process imports and the console show the fault and its correction with no new build of agenda.

Example, in the console: load("calendar"), then days_in_month(2, 2000) gives 28; the true answer is 29.

See: Module contract: Replacement of an import

calendar module with no entry

Hash
88dcc066f9f20a484c3f9cf5649831b6d7084546a639c52cb4be595bdd2881a9
Size
12288 bytes
Exports
1
Imports
0
Imported by
2
License
MIT

The days of the months of the Gregorian calendar

FactValue
KindModules with no entry
Sourcesrc/modules/libraries/calendar
Boot imageyes: in the boot image, 12288 bytes in this build
Build settingsnone: the defaults of the source
Importsnone
Imported by

Neighbours

What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.

calendar agenda imports

Exports

ExportWhat it does
days_in_month(month: Integer, year: Integer) -> Integergives the count of days of a month, from 1 to 12, of a year

days_in_month

days_in_month(month: , year: ) -> 

days_in_month gives the count of days of a month, from 1 to 12, of a year. A month out of this range stops the process on a bounds check.

The fault: a year that 100 divides is never a leap year here, so February 2000 has 28 days.

Parameters
  • month:
  • year:
Result
Source
src/modules/libraries/calendar/calendar.odin:17

Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).

Integer wire form

A wire form of the module contract: one word of a call. A signed integer of 64 bits, in a register.