Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/doc/perl-Time-Moment/eg/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/perl-Time-Moment/eg/beat.pl
#!/usr/bin/perl
use strict;
use warnings;

use Time::Moment;

# Converts the given moment to Swatch Internet Time (beat time).
# http://www.swatch.com/en/internet-time
# https://en.wikipedia.org/wiki/Swatch_Internet_Time
sub moment_to_beat {
    @_ == 1 or die q/Usage: moment_to_beat(moment)/;
    my ($tm) = @_;
    
    # Biel Meantime (BMT) is UTC+1
    my $rd = $tm->with_offset_same_instant(1*60)
                ->rd;
    return ($rd - int $rd) * 1E3;
}

my $tm = Time::Moment->now;
printf "@%3.3f\n", moment_to_beat($tm);

Hry