Created
August 12, 2016 15:55
-
-
Save adkinss/dbf992591d80e1737dbd14269635fca8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
# Without parameters, this script display the current time in epoch and date | |
# format. Supplied parameters need to be epoch times, which is each displayed | |
# in epoch and date format. The following are example outputs of the script: | |
# | |
# $ ./ctime.pl | |
# 1471016994 = Fri Aug 12 11:49:54 2016 | |
# | |
# $ ./ctime.pl $(date +%s) $(date --date=yesterday +%s) | |
# 1471016995 = Fri Aug 12 11:49:55 2016 | |
# 1470930595 = Thu Aug 11 11:49:55 2016 | |
push @ARGV, time() unless (@ARGV); | |
foreach my $arg (@ARGV) { | |
my $time = localtime($arg); | |
print "$arg = $time\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment