Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 526 lines (464 sloc) 17.502 kb
9ca7ef7 @moritz partially put back Temporal
moritz authored
1 use v6;
2 my class DateTime { ...}
3 my class Date { ...}
4
5 my role Dateish {
6 method is-leap-year($y = $.year) {
7 $y %% 4 and not $y %% 100 or $y %% 400
8 }
9
10 method days-in-month($year = $.year, $month = $.month) {
11 $month == 2 ?? self.is-leap-year($year) ?? 29 !! 28
12 !! $month == 4|6|9|11 ?? 30
13 !! 31
14 }
15
16 method daycount-from-ymd($y is copy, $m is copy, $d) {
17 # taken from <http://www.merlyn.demon.co.uk/daycount.htm>
18 $y .= Int;
19 $m .= Int;
20 if $m < 3 {
21 $m += 12;
22 --$y;
23 }
24 -678973 + $d + (153 * $m - 2) div 5
25 + 365 * $y + $y div 4
26 - $y div 100 + $y div 400;
27 }
28
29 method ymd-from-daycount($daycount) {
30 # taken from <http://www.merlyn.demon.co.uk/daycount.htm>
31 my $day = $daycount.Int + 678881;
32 my $t = (4 * ($day + 36525)) div 146097 - 1;
33 my $year = 100 * $t;
34 $day -= 36524 * $t + ($t +> 2);
35 $t = (4 * ($day + 366)) div 1461 - 1;
36 $year += $t;
37 $day -= 365 * $t + ($t +> 2);
38 my $month = (5 * $day + 2) div 153;
39 $day -= (2 + $month * 153) div 5 - 1;
40 if ($month > 9) {
41 $month -= 12;
42 $year++;
43 }
44 ($year, $month + 3, $day)
45 }
46
47 method get-daycount {
48 self.daycount-from-ymd($.year, $.month, $.day)
49 }
50
51 method day-of-month() { $.day }
52
53 method day-of-week($daycount = self.get-daycount) {
54 ($daycount + 2) % 7 + 1
55 }
56
57 method week() { # algorithm from Claus Tøndering
a48a985 @tadzik More Temporal fixes
tadzik authored
58 my $a = $.year - ($.month <= 2).floor.Int;
9ca7ef7 @moritz partially put back Temporal
moritz authored
59 my $b = $a div 4 - $a div 100 + $a div 400;
60 my $c = ($a - 1) div 4 - ($a - 1) div 100 + ($a - 1) div 400;
61 my $s = $b - $c;
62 my $e = $.month <= 2 ?? 0 !! $s + 1;
63 my $f = $.day + do $.month <= 2
64 ?? 31*($.month - 1) - 1
65 !! (153*($.month - 3) + 2) div 5 + 58 + $s;
66
67 my $g = ($a + $b) % 7;
68 my $d = ($f + $g - $e) % 7;
69 my $n = $f + 3 - $d;
70
71 $n < 0 ?? ($.year - 1, 53 - ($g - $s) div 5)
72 !! $n > 364 + $s ?? ($.year + 1, 1)
73 !! ($.year, $n div 7 + 1);
74 }
75
76 method week-year() {
77 self.week.[0]
78 }
79
80 method week-number() {
81 self.week.[1]
82 }
83
84 method weekday-of-month {
85 ($.day - 1) div 7 + 1
86 }
87
b952372 @tadzik Uncomment Date.day-of-year. We now pass S32-temporal/calendar.t; track f...
tadzik authored
88 method day-of-year() {
89 [+] $.day, map { self.days-in-month($.year, $^m) }, 1 ..^ $.month
90 }
9ca7ef7 @moritz partially put back Temporal
moritz authored
91
6fde31d @moritz two tiny Date fixes
moritz authored
92 method check-value($val is copy, $name, $range, :$allow-nonint) {
9ca7ef7 @moritz partially put back Temporal
moritz authored
93 $val = $allow-nonint ?? +$val !! $val.Int;
12b860d @jnthn A doubled 'or' caught by work in the optimizer branch.
jnthn authored
94 $val ~~ $range
9ca7ef7 @moritz partially put back Temporal
moritz authored
95 or die "$name must be in {$range.perl}\n";
96 }
97
98 method check-date {
99 self.check-value($.month, 'month', 1 .. 12);
100 self.check-value($.day, "day of $.year/$.month",
101 1 .. self.days-in-month);
102 }
103
104 method truncate-parts($unit, %parts is copy = ()) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
105 # Helper for DateTime.truncated-to and Date.truncated-to.
9ca7ef7 @moritz partially put back Temporal
moritz authored
106 if $unit eq 'week' {
107 my $dc = self.get-daycount;
108 my $new-dc = $dc - self.day-of-week($dc) + 1;
109 %parts<year month day> =
110 self.ymd-from-daycount($new-dc);
111 } else { # $unit eq 'month'|'year'
112 %parts<day> = 1;
113 $unit eq 'year' and %parts<month> = 1;
114 }
115 %parts;
116 }
117
118 }
119
120 sub default-formatter(DateTime $dt, Bool :$subseconds) {
121 # ISO 8601 timestamp (well, not strictly ISO 8601 if $subseconds
122 # is true)
123 my $o = $dt.offset;
124 $o %% 60
125 or warn "Default DateTime formatter: offset $o not divisible by 60.\n";
126 sprintf '%04d-%02d-%02dT%02d:%02d:%s%s',
127 $dt.year, $dt.month, $dt.day, $dt.hour, $dt.minute,
128 $subseconds
129 ?? $dt.second.fmt('%09.6f')
130 !! $dt.whole-second.fmt('%02d'),
131 do $o
132 ?? sprintf '%s%02d%02d',
133 $o < 0 ?? '-' !! '+',
134 ($o.abs / 60 / 60).floor,
135 ($o.abs / 60 % 60).floor
136 !! 'Z';
137 }
138
139 my class DateTime-local-timezone does Callable {
140 method Str { '<local time zone>' }
141 method perl { '$*TZ' }
142
143 method postcircumfix:<( )>($args) { self.offset(|$args) }
144
145 method offset(DateTime:D $dt, $to-utc) {
146 # We construct local and UTC DateTimes, calculate POSIX times
147 # (pretending the local DateTime is actually in UTC), and
148 # return the difference. Surprisingly, this actually works!
149 if $to-utc {
150 my Mu $fia := pir::new__PS('FixedIntegerArray');
ab30d74 @moritz [Temporal] initialize length of FixedIntegerArray
moritz authored
151 pir::set__vPI($fia, 9);
a48a985 @tadzik More Temporal fixes
tadzik authored
152 nqp::bindpos($fia, 0, nqp::unbox_i($dt.whole-second));
9ca7ef7 @moritz partially put back Temporal
moritz authored
153 nqp::bindpos($fia, 1, nqp::unbox_i($dt.minute));
154 nqp::bindpos($fia, 2, nqp::unbox_i($dt.hour));
155 nqp::bindpos($fia, 3, nqp::unbox_i($dt.day));
156 nqp::bindpos($fia, 4, nqp::unbox_i($dt.month));
157 nqp::bindpos($fia, 5, nqp::unbox_i($dt.year));
158 nqp::bindpos($fia, 8, -1);
159 nqp::p6box_i(pir::encodelocaltime__IP($fia)) - $dt.posix(True);
160 } else {
161 my $p = $dt.posix;
162 my ($year, $month, $day, $hour, $minute, $second);
eb855f3 @tadzik Fix DateTime.now
tadzik authored
163 my Mu $fia := pir::decodelocaltime__PI(nqp::unbox_i($p.Int));
164 $second = nqp::p6box_i(nqp::atpos($fia, 0));
165 $minute = nqp::p6box_i(nqp::atpos($fia, 1));
166 $hour = nqp::p6box_i(nqp::atpos($fia, 2));
167 $day = nqp::p6box_i(nqp::atpos($fia, 3));
168 $month = nqp::p6box_i(nqp::atpos($fia, 4));
169 $year = nqp::p6box_i(nqp::atpos($fia, 5));
9ca7ef7 @moritz partially put back Temporal
moritz authored
170 DateTime\
171 .new(:$year, :$month, :$day, :$hour, :$minute, :$second)\
172 .posix - $p;
173 }
174 }
175 }
176
177 my class DateTime does Dateish {
bb7c108 @jnthn Uncoment most of class DateTime.
jnthn authored
178 has Int $.year;
179 has Int $.month = 1;
180 has Int $.day = 1;
181
182 has Int $.hour = 0;
183 has Int $.minute = 0;
184 has $.second = 0.0;
185 has $.timezone = 0; # UTC
186 has &.formatter = &default-formatter;
187 has Int $!saved-offset;
188 # Not an optimization but a necessity to ensure that
189 # $dt.utc.local.utc is equivalent to $dt.utc. Otherwise,
190 # DST-induced ambiguity could ruin our day.
191
192 multi method new(Int :$year!, :&formatter=&default-formatter, *%_) {
193 my $dt = self.bless(*, :$year, :&formatter, |%_);
194 $dt.check-date;
195 $dt.check-time;
196 $dt;
197 }
198
199 method check-time {
200 # Asserts the validity of and numifies $!hour, $!minute, and $!second.
201 self.check-value($!hour, 'hour', 0 ..^ 24);
202 self.check-value($!minute, 'minute', 0 ..^ 60);
203 self.check-value($!second, 'second', 0 ..^ 62, :allow-nonint);
204 if $!second >= 60 {
205 # Ensure this is an actual leap second.
206 self.second < 61
207 or die 'No second 61 has yet been defined';
208 my $dt = self.utc;
209 $dt.hour == 23 && $dt.minute == 59
210 or die 'A leap second can occur only at hour 23 and minute 59 UTC';
211 my $date = sprintf '%04d-%02d-%02d',
212 $dt.year, $dt.month, $dt.day;
213 $date eq any(tai-utc::leap-second-dates)
214 or die "There is no leap second on UTC $date";
215 }
216 }
217
218 multi method new(Date :$date!, *%_) {
219 self.new(year => $date.year, month => $date.month,
220 day => $date.day, |%_)
221 }
222
223 multi method new(Instant $i, :$timezone=0, :&formatter=&default-formatter) {
224 my ($p, $leap-second) = $i.to-posix;
375fa0a @tadzik Small Temporal tune, fixes Date.new(Instant)
tadzik authored
225 my $dt = self.new: floor($p - $leap-second).Int, :&formatter;
eb855f3 @tadzik Fix DateTime.now
tadzik authored
226 $dt.clone(second => ($dt.second + $p % 1 + $leap-second)
bb7c108 @jnthn Uncoment most of class DateTime.
jnthn authored
227 ).in-timezone($timezone);
228 }
229
230 multi method new(Int $time is copy, :$timezone=0, :&formatter=&default-formatter) {
231 # Interpret $time as a POSIX time.
232 my $second = $time % 60; $time = $time div 60;
233 my $minute = $time % 60; $time = $time div 60;
234 my $hour = $time % 24; $time = $time div 24;
235 # Day month and leap year arithmetic, based on Gregorian day #.
236 # 2000-01-01 noon UTC == 2451558.0 Julian == 2451545.0 Gregorian
237 $time += 2440588; # because 2000-01-01 == Unix epoch day 10957
238 my $a = $time + 32044; # date algorithm from Claus Tøndering
239 my $b = (4 * $a + 3) div 146097; # 146097 = days in 400 years
240 my $c = $a - (146097 * $b) div 4;
241 my $d = (4 * $c + 3) div 1461; # 1461 = days in 4 years
242 my $e = $c - ($d * 1461) div 4;
243 my $m = (5 * $e + 2) div 153; # 153 = days in Mar-Jul Aug-Dec
244 my $day = $e - (153 * $m + 2) div 5 + 1;
245 my $month = $m + 3 - 12 * ($m div 10);
246 my $year = $b * 100 + $d - 4800 + $m div 10;
247 self.bless(*, :$year, :$month, :$day,
248 :$hour, :$minute, :$second,
249 :&formatter).in-timezone($timezone);
250 }
251
252 multi method new(Str $format, :$timezone is copy = 0, :&formatter=&default-formatter) {
253 $format ~~ /^ (\d**4) '-' (\d\d) '-' (\d\d) T (\d\d) ':' (\d\d) ':' (\d\d) (Z || (<[\-\+]>) (\d\d)(\d\d))? $/
254 or die 'Invalid DateTime string; please an ISO 8601 timestamp';
255 my $year = (+$0).Int;
256 my $month = (+$1).Int;
257 my $day = (+$2).Int;
258 my $hour = (+$3).Int;
259 my $minute = (+$4).Int;
260 my $second = +$5;
261 if $6 {
262 $timezone
263 and die "DateTime.new(Str): :timezone argument not allowed with a timestamp offset";
264 if $6 eq 'Z' {
265 $timezone = 0;
266 } else {
267 $timezone = (($6[0][1]*60 + $6[0][2]) * 60).Int;
268 # RAKUDO: .Int is needed to avoid to avoid the nasty '-0'.
269 $6[0][0] eq '-' and $timezone = -$timezone;
270 }
271 }
272 self.new(:$year, :$month, :$day, :$hour, :$minute,
273 :$second, :$timezone, :&formatter);
274 }
275
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
276 method now(:$timezone=$*TZ, :&formatter=&default-formatter) {
277 self.new(now, :$timezone, :&formatter)
278 }
9ca7ef7 @moritz partially put back Temporal
moritz authored
279
bb7c108 @jnthn Uncoment most of class DateTime.
jnthn authored
280 method clone(*%_) {
eb855f3 @tadzik Fix DateTime.now
tadzik authored
281 my %args = { :$!year, :$!month, :$!day, :$!hour, :$!minute,
282 :$!second, :$!timezone, :&!formatter, %_ };
283 self.new(|%args);
bb7c108 @jnthn Uncoment most of class DateTime.
jnthn authored
284 }
285
286 method clone-without-validating(*%_) { # A premature optimization.
eb855f3 @tadzik Fix DateTime.now
tadzik authored
287 my %args = { :$!year, :$!month, :$!day, :$!hour, :$!minute,
288 :$!second, :$!timezone, :&!formatter, %_ };
289 self.bless(*, |%args);
bb7c108 @jnthn Uncoment most of class DateTime.
jnthn authored
290 }
291
292 method Instant() {
293 Instant.from-posix: self.posix + $.second % 1, $.second >= 60;
294 }
295
296 method posix($ignore-timezone?) {
297 $ignore-timezone or self.offset == 0
298 or return self.utc.posix;
299 # algorithm from Claus Tøndering
300 my $a = (14 - $.month.Int) div 12;
301 my $y = $.year.Int + 4800 - $a;
302 my $m = $.month.Int + 12 * $a - 3;
303 my $jd = $.day + (153 * $m + 2) div 5 + 365 * $y
304 + $y div 4 - $y div 100 + $y div 400 - 32045;
305 ($jd - 2440588) * 24 * 60 * 60
306 + 60*(60*$.hour + $.minute) + self.whole-second;
307 }
308
309 method offset {
310 $!saved-offset or
311 $!timezone ~~ Callable
312 ?? $!timezone(self, True)
313 !! $!timezone
314 }
315
316 method truncated-to(*%args) {
317 %args.keys == 1
318 or die 'DateTime.truncated-to: exactly one named argument needed';
319 my $unit = %args.keys[0];
320 $unit eq any(<second minute hour day week month year>)
321 or die "DateTime.truncated-to: Unknown truncation unit '$unit'";
322 my %parts;
323 given $unit {
324 %parts<second> = self.whole-second;
325 when 'second' {}
326 %parts<second> = 0;
327 when 'minute' {}
328 %parts<minute> = 0;
329 when 'hour' {}
330 %parts<hour> = 0;
331 when 'day' {}
332 # Fall through to Dateish.
333 %parts = self.truncate-parts($unit, %parts);
334 }
335 self.clone-without-validating(|%parts);
336 }
337
338 method whole-second() {
a48a985 @tadzik More Temporal fixes
tadzik authored
339 floor($.second).Int
bb7c108 @jnthn Uncoment most of class DateTime.
jnthn authored
340 }
341
342 method in-timezone($timezone) {
343 $timezone eqv $!timezone and return self;
344 my $old-offset = self.offset;
345 my $new-offset = $timezone ~~ Callable
346 ?? $timezone(self.utc, False)
347 !! $timezone;
348 my %parts;
349 # Is the logic for handling leap seconds right?
350 # I don't know, but it passes the tests!
351 my $a = ($!second >= 60 ?? 59 !! $!second)
352 + $new-offset - $old-offset;
eb855f3 @tadzik Fix DateTime.now
tadzik authored
353 %parts<second> = $!second >= 60 ?? $!second !! ($a % 60).Int;
bb7c108 @jnthn Uncoment most of class DateTime.
jnthn authored
354 my $b = $!minute + floor $a / 60;
eb855f3 @tadzik Fix DateTime.now
tadzik authored
355 %parts<minute> = ($b % 60).Int;
bb7c108 @jnthn Uncoment most of class DateTime.
jnthn authored
356 my $c = $!hour + floor $b / 60;
eb855f3 @tadzik Fix DateTime.now
tadzik authored
357 %parts<hour> = ($c % 24).Int;
bb7c108 @jnthn Uncoment most of class DateTime.
jnthn authored
358 # Let Dateish handle any further rollover.
359 floor $c / 24 and %parts<year month day> =
360 self.ymd-from-daycount\
361 (self.get-daycount + floor $c / 24);
362 self.clone-without-validating:
363 :$timezone, saved-offset => $new-offset, |%parts;
364 }
365
366 method utc() {
367 self.in-timezone(0)
368 }
369 method local() {
370 self.in-timezone($*TZ)
371 }
372
373 method Date() {
374 Date.new(self)
375 }
376
377 method Str() {
378 &!formatter(self)
379 }
380
381 multi method perl(DateTime:D:) {
382 sprintf 'DateTime.new(%s)', join ', ', map { "{.key} => {.value}" }, do
383 :$.year, :$.month, :$.day, :$.hour, :$.minute,
384 second => $.second.perl,
385 (timezone => $.timezone.perl
386 unless $.timezone === 0),
387 (:$!saved-offset
388 if $!saved-offset and $.timezone ~~ Callable),
389 (formatter => $.formatter.perl
390 unless &.formatter eqv &default-formatter)
391 }
9ca7ef7 @moritz partially put back Temporal
moritz authored
392 }
393
394 my class Date does Dateish {
395 has Int $.year;
396 has Int $.month = 1;
397 has Int $.day = 1;
398
399 has Int $.daycount;
400
401 method !set-daycount($dc) { $!daycount = $dc }
402
403 method get-daycount { $!daycount }
404
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
405 multi method new(:$year!, :$month, :$day) {
406 my $d = self.bless(*, :$year, :$month, :$day);
407 $d.check-date;
408 $d!set-daycount(self.daycount-from-ymd($year,$month,$day));
409 $d;
410 }
411
412 multi method new($year, $month, $day) {
413 self.new(:$year, :$month, :$day);
414 }
415
375fa0a @tadzik Small Temporal tune, fixes Date.new(Instant)
tadzik authored
416 multi method new(Str $date) {
417 $date ~~ /^ \d\d\d\d '-' \d\d '-' \d\d $/
418 or die 'Invalid Date string; please use the format "yyyy-mm-dd"';
419 self.new(|$date.split('-').map({.Int}));
420 }
421
422 multi method new(DateTime $dt) {
423 self.bless(*,
424 :year($dt.year), :month($dt.month), :day($dt.day),
425 :daycount(self.daycount-from-ymd($dt.year,$dt.month,$dt.day))
426 );
427 }
428
429 method new-from-daycount($daycount) {
430 my ($year, $month, $day) = self.ymd-from-daycount($daycount);
431 self.bless(*, :$daycount, :$year, :$month, :$day);
432 }
433
434 method today() {
435 self.new(DateTime.now);
436 }
437
438 method truncated-to(*%args) {
439 %args.keys == 1
440 or die "Date.truncated-to: exactly one named argument needed.";
441 my $unit = %args.keys[0];
442 $unit eq any(<week month year>)
443 or die "DateTime.truncated-to: Unknown truncation unit '$unit'";
444 self.clone(|self.truncate-parts($unit));
445 }
446
447 method clone(*%_) {
048cfd5 @tadzik Fix Date.clone. We now pass S32-temporal/Date.t
tadzik authored
448 my %args = { :$!year, :$!month, :$!day, %_ };
449 self.new(|%args);
375fa0a @tadzik Small Temporal tune, fixes Date.new(Instant)
tadzik authored
450 }
451
452 method succ() {
453 Date.new-from-daycount($!daycount + 1);
454 }
455 method pred() {
456 Date.new-from-daycount($!daycount - 1);
457 }
458
459 multi method Str(Date:D:) {
460 sprintf '%04d-%02d-%02d', $.year, $.month, $.day;
461 }
462
463 multi method perl(Date:D:) {
464 "Date.new($.year.perl(), $.month.perl(), $.day.perl())";
465 }
9ca7ef7 @moritz partially put back Temporal
moritz authored
466 }
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
467
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
468 multi infix:<+>(Date:D $d, Int:D $x) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
469 Date.new-from-daycount($d.daycount + $x)
470 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
471 multi infix:<+>(Int:D $x, Date:D $d) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
472 Date.new-from-daycount($d.daycount + $x)
473 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
474 multi infix:<->(Date:D $d, Int:D $x) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
475 Date.new-from-daycount($d.daycount - $x)
476 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
477 multi infix:<->(Date:D $a, Date:D $b) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
478 $a.daycount - $b.daycount;
479 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
480 multi infix:<cmp>(Date:D $a, Date:D $b) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
481 $a.daycount cmp $b.daycount
482 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
483 multi infix:«<=>»(Date:D $a, Date:D $b) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
484 $a.daycount <=> $b.daycount
485 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
486 multi infix:<==>(Date:D $a, Date:D $b) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
487 $a.daycount == $b.daycount
488 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
489 multi infix:<!=>(Date:D $a, Date:D $b) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
490 $a.daycount != $b.daycount
491 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
492 multi infix:«<=»(Date:D $a, Date:D $b) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
493 $a.daycount <= $b.daycount
494 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
495 multi infix:«<»(Date:D $a, Date:D $b) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
496 $a.daycount < $b.daycount
497 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
498 multi infix:«>=»(Date:D $a, Date:D $b) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
499 $a.daycount >= $b.daycount
500 }
bbe78ec @jnthn Remove a bunch of 'is export's that shouldn't have been there. Not sure ...
jnthn authored
501 multi infix:«>»(Date:D $a, Date:D $b) {
118be55 @jnthn Uncomment rest of temporal stuff. Removed 'multi' in a couple of places ...
jnthn authored
502 $a.daycount > $b.daycount
503 }
504
eb855f3 @tadzik Fix DateTime.now
tadzik authored
505 $PROCESS::TZ = DateTime-local-timezone.new;
506
9ca7ef7 @moritz partially put back Temporal
moritz authored
507 # =begin pod
508 #
509 # =head1 SEE ALSO
510 # Perl 6 spec <S32-Temporal|http://perlcabal.org/syn/S32/Temporal.html>.
511 # The Perl 5 DateTime Project home page L<http://datetime.perl.org>.
512 # Perl 5 perldoc L<doc:DateTime> and L<doc:Time::Local>.
513 #
514 # The best yet seen explanation of calendars, by Claus Tøndering
515 # L<Calendar FAQ|http://www.tondering.dk/claus/calendar.html>.
516 # Similar algorithms at L<http://www.hermetic.ch/cal_stud/jdn.htm>
517 # and L<http://www.merlyn.demon.co.uk/daycount.htm>.
518 #
519 # <ISO 8601|http://en.wikipedia.org/wiki/ISO_8601>
520 # <Time zones|http://en.wikipedia.org/wiki/List_of_time_zones>
521 #
522 # As per the recommendation, the strftime() method has bee moved into a
523 # loadable module called DateTime::strftime.
524 #
525 # =end pod
Something went wrong with that request. Please try again.