Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created December 31, 2015 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/6f3add4b642dbf37eb45 to your computer and use it in GitHub Desktop.
Save zoffixznet/6f3add4b642dbf37eb45 to your computer and use it in GitHub Desktop.
method irc-connected ($irc) {
my $utc-hny = utc-hny;
$irc.debug and say "UTC HNY is $utc-hny";
my @offsets = get-tzs;
my $prev-offset = now + 10;
for get-tzs() -> $tz {
my $cur-offset = $utc-hny.Instant + $tz<offset>*3600;
next if $cur-offset - now <= 0;
say "Starting prev {$cur-offset - $prev-offset}";
Promise.at( $prev-offset ).then: {
say "Making Nex New Year announcemnet: {$cur-offset - $prev-offset}";
my $x = $cur-offset - $prev-offset;
announce-hny $irc, $tz,
:next-new-year($x ),
:$!short-announcement-at;
};
say "Starting cur {DateTime.new: $cur-offset}";
Promise.at( $cur-offset ).then: {
announce-hny $irc, $tz, :$!short-announcement-at;
};
$prev-offset = $cur-offset;
}
# say denominate $utc-hny.Instant - (DateTime.now.utc.Instant + (-5*3600) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment