use Time::HiRes qw( time ); # Number of secs between 1900/01/01 UTC and 1970/01/01 UTC. my $ntp_epoch_diff = 2208988800; my $time = time(); my $ntp_ts = sprintf('%08X.%08X', int($time) + $ntp_epoch_diff, ($time - int($time)) * (2**32), );