Perl 5.26.1, repeatedly subtracting 60*60*24 seconds (1 day) from Unix time, then rendering it with "scalar localtime" and strftime. script given below. we start at noon on March 2, year 0 (1 BC) of the proleptic Gregorian calendar.
March 1 repeats, and February has 31 days:
-62161887838 : Thu Mar 2 12:00:00 0 : Thursday, March 2, 0 12:00:00 : 0 0 12 2 2 -1900 4 61 0
-62161974238 : Wed Mar 1 12:00:00 0 : Wednesday, March 1, 0 12:00:00 : 0 0 12 1 2 -1900 3 60 0
-62162060638 : Tue Feb 29 12:00:00 0 : Wednesday, March 1, 0 12:00:00 : 0 0 12 29 1 -1900 2 59 0
-62162147038 : Mon Feb 28 12:00:00 0 : Tuesday, February 31, 0 12:00:00 : 0 0 12 28 1 -1900 1 58 0
-62162233438 : Sun Feb 27 12:00:00 0 : Monday, February 30, 0 12:00:00 : 0 0 12 27 1 -1900 0 57 0
-62162319838 : Sat Feb 26 12:00:00 0 : Sunday, February 29, 0 12:00:00 : 0 0 12 26 1 -1900 6 56 0
-62162406238 : Fri Feb 25 12:00:00 0 : Saturday, February 28, 0 12:00:00 : 0 0 12 25 1 -1900 5 55 0
January has 30 days:
-62164479838 : Tue Feb 1 12:00:00 0 : Wednesday, February 4, 0 12:00:00 : 0 0 12 1 1 -1900 2 31 0
-62164566238 : Mon Jan 31 12:00:00 0 : Tuesday, February 3, 0 12:00:00 : 0 0 12 31 0 -1900 1 30 0
-62164652638 : Sun Jan 30 12:00:00 0 : Monday, February 2, 0 12:00:00 : 0 0 12 30 0 -1900 0 29 0
-62164739038 : Sat Jan 29 12:00:00 0 : Sunday, February 1, 0 12:00:00 : 0 0 12 29 0 -1900 6 28 0
-62164825438 : Fri Jan 28 12:00:00 0 : Saturday, January 30, 0 12:00:00 : 0 0 12 28 0 -1900 5 27 0
noon changes by 3 minutes and 58 seconds, cannot print the month before January, year does not decrement:
-62167158238 : Sat Jan 1 12:00:00 0 : Sunday, January 3, 0 12:00:00 : 0 0 12 1 0 -1900 6 0 0
-62167244638 : Fri Dec 31 11:56:02 -1 : Saturday, January 2, 0 11:56:02 : 2 56 11 31 11 -1901 5 364 0
-62167331038 : Thu Dec 30 11:56:02 -1 : Friday, January 1, 0 11:56:02 : 2 56 11 30 11 -1901 4 363 0
-62167417438 : Wed Dec 29 11:56:02 -1 : Thursday, ? 31, 0 11:56:02 : 2 56 11 29 11 -1901 3 362 0
day of the month becomes negative, unable to print day of the week:
-62172687838 : Fri Oct 29 12:56:02 -1 : Saturday, ? 31, 0 12:56:02 : 2 56 12 29 9 -1901 5 301 1
-62172774238 : Thu Oct 28 12:56:02 -1 : Friday, ? -1, 0 12:56:02 : 2 56 12 28 9 -1901 4 300 1
-62172860638 : Wed Oct 27 12:56:02 -1 : Thursday, ? -2, 0 12:56:02 : 2 56 12 27 9 -1901 3 299 1
-62172947038 : Tue Oct 26 12:56:02 -1 : Wednesday, ? -3, 0 12:56:02 : 2 56 12 26 9 -1901 2 298 1
-62173033438 : Mon Oct 25 12:56:02 -1 : Tuesday, ? -4, 0 12:56:02 : 2 56 12 25 9 -1901 1 297 1
-62173119838 : Sun Oct 24 12:56:02 -1 : Monday, ? -5, 0 12:56:02 : 2 56 12 24 9 -1901 0 296 1
-62173206238 : Sat Oct 23 12:56:02 -1 : Sunday, ? -6, 0 12:56:02 : 2 56 12 23 9 -1901 6 295 1
-62173292638 : Fri Oct 22 12:56:02 -1 : ?, ? -7, 0 12:56:02 : 2 56 12 22 9 -1901 5 294 1
year finally decrements, March has 1 day, February has 31 days:
-62193510238 : Tue Mar 2 11:56:02 -1 : ?, ? -27, 0 11:56:02 : 2 56 11 2 2 -1901 2 60 0
-62193596638 : Mon Mar 1 11:56:02 -1 : ?, March 1, -1 11:56:02 : 2 56 11 1 2 -1901 1 59 0
-62193683038 : Sun Feb 28 11:56:02 -1 : ?, February 31, -1 11:56:02 : 2 56 11 28 1 -1901 0 58 0
#!perl -w
use POSIX qw(strftime mktime round);
$second=$minute=0;
$hour=12;
$year=0;
$month=3;
$day=2;
$t=mktime($second,$minute,$hour,$day,$month-1,$year-1900);
for(0..1000){
$s=localtime($t);
@v=localtime($t);
print$t," : ",$s," : ",strftime('%A, %B %e, %Y %T',$v[0],$v[1],$v[2],$v[3],$v[4],$v[5]),' :';
for(@v){
print" $_";
}
print "\n";
$t-= 60*60*24.;
}
No comments :
Post a Comment