Skip to content

Instantly share code, notes, and snippets.

@arkiuat
Last active September 12, 2025 03:05
Show Gist options
  • Select an option

  • Save arkiuat/7e169d8a106a919f50a21f8435604dda to your computer and use it in GitHub Desktop.

Select an option

Save arkiuat/7e169d8a106a919f50a21f8435604dda to your computer and use it in GitHub Desktop.
my constant @lsmonth := <
1972-06 1972-12 1973-12 1974-12 1975-12 1976-12 1977-12 1978-12 1979-12
1981-06 1982-06 1983-06 1985-06 1987-12 1989-12 1990-12 1992-06 1993-06
1994-06 1995-12 1997-06 1998-12 2005-12 2008-12 2012-06 2015-06 2016-12
>;
sub leap-sec( Int(Str) $year, Int(Str) $month --> DateTime ) {
DateTime.new(
date => Date.new($year, $month, 1).last-date-in-month,
:23hour,
:59minute,
:60second
)
}
my constant @leapsec := @lsmonth.comb(/\d+/).map(&leap-sec);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment