Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed DateTime::strftime from Rakudo #1959

Closed
p6rt opened this issue Jul 21, 2010 · 4 comments
Closed

Removed DateTime::strftime from Rakudo #1959

p6rt opened this issue Jul 21, 2010 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 21, 2010

Migrated from rt.perl.org#76642 (status was 'resolved')

Searchable as RT76642$

@p6rt
Copy link
Author

p6rt commented Jul 21, 2010

From @supernovus

The attached patch removes the DateTime​::strftime module from Rakudo's tree.
The module (now called DateTime​::Utils) has moved into it's own project​:

http://github.com/supernovus/temporal-utils/

I will request it be added to proto/pls, and that it should be considered
for inclusion as a bundled module with Rakudo Star.

@p6rt
Copy link
Author

p6rt commented Jul 21, 2010

From @supernovus

0001-Removed-DateTime-strftime-as-it-s-moved-to-an-extern.patch
From 93b1c35d04e897f3e7a836e01b279bb22a574db1 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 insertions(+), 93 deletions(-)
 delete mode 100644 lib/DateTime/strftime.pm

diff --git a/build/Makefile.in b/build/Makefile.in
index c19af17..7b88140 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 210c1d0..0000000
--- 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.
-        <Monday Tuesday Wednesday Thursday
-        Friday Saturday Sunday>[$i - 1]
-    }
-
-    sub month-name($i) {
-        <January February March April May June July August
-        September October November December>[$i - 1]
-    }
-
-}
-
-- 
1.7.0.4

@p6rt
Copy link
Author

p6rt commented Jul 24, 2010

From @moritz

It seems that this patch has been applied, so I'm closing the ticket now.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jul 24, 2010

@moritz - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Jul 24, 2010
@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant