#!/usr/local/bin/perl use strict; use warnings; use feature ':all'; my $head = 0x0000_0000_0000_0000; my $tail = 0x7fff_ffff_ffff_ffff; my ($when, $next); while ($next = $head + $tail >> 1) { last if $when == $next; $when = $next; # warn "$head, $when, $tail"; !!(gmtime $when) ? $head = $when + 1 : $tail = $when - 1; } say $when; say scalar gmtime $when; say scalar localtime $when; say scalar gmtime $when+1;