You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
885 B
Raku

#!/usr/bin/perl -w
$t = time();
# Convert seconds to local time.
($sec, $min, $hour, $dom, $mon, $year,$wday, $yday, $isdst) = localtime($t);
# Convert data to normal values.
$year += 1900;
# Provide English equivalents.
@months = ("January", "February",
"March", "April", "May",
"June", "July", "August",
"September", "October",
"November", "December");
@week = ("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday",
"Friday", "Saturday");
# Print data.
printf("Time is: %2.2d:%2.2d:%2.2d\n",
$hour, $min, $sec);
printf("Date is: %s, %d-%s-%d\n",
$week[$wday], $dom, $months[$mon],
$year);
printf("%d days since 1 January\n",
$yday);
if ($isdst) {
print "Is daylight savings time.\n";
} else {
print "No daylight savings time in effect.\n";
}