sub detect_dst_clockface_sector { my $t1 = Mktime(@_, 0, 0, 0); my $t2 = Mktime(Add_Delta_Days(@_, 1), 0, 0, 0); my $shift = 24 - ($t2 - $t1) / 3600; return if !$shift; my ($i, $it1, $it2) = 0; while ( $i < 24 ) { $it2 = $t1 + $i * 3600; $it1 = $it2 - 1; $_ = (localtime($_))[2] for $it1, $it2; last if $it2 == ($it1+$shift+1) % 24; } continue { $i++; } if ( $i < 24 ) { return $i, $shift; } else { die "Couldn't figure out position of $shift dst-affected hours"; } }