Safe Haskell | None |
---|---|
Language | Haskell98 |
Documentation
A date packed into a 32-bit word.
The bitwise format is:
32 16 8 0 | year | month | day |
Pros: Packing and unpacking a Date32 is simpler than using other formats that represent dates as a number of days from some epoch. We can also avoid worrying about what the epoch should be, and the representation will not overflow until year 65536.
Cons: Computing a range of dates is slower than with representations using an epoch, as we cannot simply add one to get to the next valid date.
pack :: (Word, Word, Word) -> Date32 Source
Pack a year, month and day into a Word32
.
If any components of the date are out-of-range then they will be bit-wise truncated so they fit in their destination fields.
next :: Date32 -> Date32 Source
Yield the next date in the series.
This assumes leap years occur every four years, which is valid after year 1900 and before year 2100.
range :: Date32 -> Date32 -> Array Date32 Source
Yield an array containing a range of dates, inclusive of the end points.
Pretty print a Date32