1. Shlomi Fish
  2. shlomif-computer-settings

Commits

Shlomi Fish  committed e5d9297

Add the format-time-duration program.

  • Participants
  • Parent commits 598df83
  • Branches default

Comments (0)

Files changed (1)

File shlomif-settings/home-bin-executables/bin/format-time-duration

View file
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use feature qw/say/;
+
+use DateTime::Format::Duration;
+
+my $seconds = shift(@ARGV);
+
+my $d = DateTime::Format::Duration->new(
+    normalise => 1,
+    pattern => '%Y years, %m months, %e days, '.
+    '%H hours, %M minutes, %S seconds'
+);
+
+say $d->format_duration( DateTime::Duration->new( seconds => $seconds) );