From 220b6781621b6bf3c3d2fd6070b7f74efd86c8df Mon Sep 17 00:00:00 2001 From: Timothy Totten <2009@huri.net> Date: Wed, 21 Jul 2010 14:54:22 -0700 Subject: [PATCH] Removed DateTime::strftime, as it's moved to an external repo. --- build/Makefile.in | 10 +---- lib/DateTime/strftime.pm | 84 ---------------------------------------- 2 files changed, 1 insertion(+), 93 deletions(-) delete mode 100644 lib/DateTime/strftime.pm diff --git a/build/Makefile.in b/build/Makefile.in index c19af171088..7b8814013bb 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -281,7 +281,7 @@ HARNESS_WITH_FUDGE_JOBS = $(HARNESS_WITH_FUDGE) --jobs STAGESTATS = @stagestats@ # the default target, TODO: make libraries in 'lib' a variable. -all: $(PERL6_EXE) Test.pir lib/DateTime/strftime.pir +all: $(PERL6_EXE) Test.pir # the install target install: all @@ -291,9 +291,6 @@ install: all $(CP) Test.pir $(DESTDIR)$(PERL6_LANG_DIR)/lib $(CP) lib/*.pm $(DESTDIR)$(PERL6_LANG_DIR)/lib $(CP) lib/*.pir $(DESTDIR)$(PERL6_LANG_DIR)/lib - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/lib/DateTime - $(CP) lib/DateTime/*.pm $(DESTDIR)$(PERL6_LANG_DIR)/lib/DateTime - $(CP) lib/DateTime/*.pir $(DESTDIR)$(PERL6_LANG_DIR)/lib/DateTime $(MKPATH) $(DESTDIR)$(PARROT_LIB_DIR)/dynext $(CP) $(DYNPMC) $(DYNOPS) $(DESTDIR)$(PARROT_LIB_DIR)/dynext @@ -406,11 +403,6 @@ $(PMC_DIR)/objectref.pmc : $(PMC_DIR)/objectref_pmc.template build/gen_objectref Test.pir: Test.pm perl6.pbc $(PARROT) $(PARROT_ARGS) perl6.pbc $(STAGESTATS) --target=pir --output=Test.pir Test.pm - -## loadable libraries. This should be refactored into something generic. -lib/DateTime/strftime.pir: lib/DateTime/strftime.pm perl6.pbc - $(PARROT) $(PARROT_ARGS) perl6.pbc $(STAGESTATS) --target=pir --output=lib/DateTime/strftime.pir lib/DateTime/strftime.pm - test : coretest fulltest: coretest stresstest diff --git a/lib/DateTime/strftime.pm b/lib/DateTime/strftime.pm deleted file mode 100644 index 210c1d018b4..00000000000 --- a/lib/DateTime/strftime.pm +++ /dev/null @@ -1,84 +0,0 @@ -use v6; -# A strftime() subroutine. - -module DateTime::strftime { - - multi sub strftime( Str $format is copy, DateTime $dt ) is export(:DEFAULT) { - my %substitutions = - # Standard substitutions for yyyy mm dd hh mm ss output. - 'Y' => { $dt.year.fmt( '%04d') }, - 'm' => { $dt.month.fmt( '%02d') }, - 'd' => { $dt.day.fmt( '%02d') }, - 'H' => { $dt.hour.fmt( '%02d') }, - 'M' => { $dt.minute.fmt('%02d') }, - 'S' => { $dt.whole-second.fmt('%02d') }, - # Special substitutions (Posix-only subset of DateTime or libc) - 'a' => { day-name($dt.day-of-week).substr(0,3) }, - 'A' => { day-name($dt.day-of-week) }, - 'b' => { month-name($dt.month).substr(0,3) }, - 'B' => { month-name($dt.month) }, - 'C' => { ($dt.year/100).fmt('%02d') }, - 'e' => { $dt.day.fmt('%2d') }, - 'F' => { $dt.year.fmt('%04d') ~ '-' ~ $dt.month.fmt( - '%02d') ~ '-' ~ $dt.day.fmt('%02d') }, - 'I' => { (($dt.hour+23)%12+1).fmt('%02d') }, - 'k' => { $dt.hour.fmt('%2d') }, - 'l' => { (($dt.hour+23)%12+1).fmt('%2d') }, - 'n' => { "\n" }, - 'N' => { (($dt.second % 1)*1000000000).fmt('%09d') }, - 'p' => { ($dt.hour < 12) ?? 'am' !! 'pm' }, - 'P' => { ($dt.hour < 12) ?? 'AM' !! 'PM' }, - 'r' => { (($dt.hour+23)%12+1).fmt('%02d') ~ ':' ~ - $dt.minute.fmt('%02d') ~ ':' ~ $dt.whole-second.fmt('%02d') - ~ (($.hour < 12) ?? 'am' !! 'pm') }, - 'R' => { $dt.hour.fmt('%02d') ~ ':' ~ $dt.minute.fmt('%02d') }, - 's' => { $dt.posix.fmt('%d') }, - 't' => { "\t" }, - 'T' => { $dt.hour.fmt('%02d') ~ ':' ~ $dt.minute.fmt('%02d') ~ ':' ~ $dt.whole-second.fmt('%02d') }, - 'u' => { ~ $dt.day-of-week.fmt('%d') }, - 'w' => { ~ (($dt.day-of-week+6) % 7).fmt('%d') }, - 'x' => { $dt.year.fmt('%04d') ~ '-' ~ $dt.month.fmt('%02d') ~ '-' ~ $dt.day.fmt('%2d') }, - 'X' => { $dt.hour.fmt('%02d') ~ ':' ~ $dt.minute.fmt('%02d') ~ ':' ~ $dt.whole-second.fmt('%02d') }, - 'y' => { ($dt.year % 100).fmt('%02d') }, - '%' => { '%' }, - '3' => { (($dt.second % 1)*1000).fmt('%03d') }, - '6' => { (($dt.second % 1)*1000000).fmt('%06d') }, - '9' => { (($dt.second % 1)*1000000000).fmt('%09d') }, - 'z' => { $dt.timezone ~~ Callable and die "stftime: Can't use 'z' with Callable time zones."; - my $o = $dt.timezone; - $o - ?? sprintf '%s%02d%02d', - $o < 0 ?? '-' !! '+', - ($o.abs / 60 / 60).floor, - ($o.abs / 60 % 60).floor - !! 'Z' } - ; - my $result = ''; - while $format ~~ / ^ (<-['%']>*) '%' (.)(.*) $ / { - unless %substitutions.exists(~$1) { die "unknown strftime format: %$1"; } - $result ~= $0 ~ %substitutions{~$1}(); - $format = ~$2; - if $1 eq '3'|'6'|'9' { - if $format.substr(0,1) ne 'N' { die "strftime format %$1 must be followed by N"; } - $format = $format.substr(1); - } - } - # The subst for masak++'s nicer-strftime branch is NYI - # $format .= subst( /'%'(\w|'%')/, { (%substitutions{~$0} - # // die "Unknown format letter '\%$0'").() }, :global ); - return $result ~ $format; - } - - sub day-name($i) { - # ISO 8601 says Monday is the first day of the week. - [$i - 1] - } - - sub month-name($i) { - [$i - 1] - } - -} -