File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,28 @@ the first of the two possible seconds in the case of a leap second.
31
31
say DateTime.new(Instant.from-posix(915148800, True)); # 1998-12-31T23:59:60Z
32
32
say DateTime.new(Instant.from-posix(915148800)); # 1999-01-01T00:00:00Z
33
33
34
+ B < Note: > the method does not attempt to make any guesses about possible positions
35
+ of leap seconds in the future and only uses the already-known leap seconds.
36
+ This means you can get different results, depending on the compiler version you're
37
+ using. For example, the December 31, 2016 leap second was announced in July and
38
+ shipped with Rakudo 2016.07, so 2016.06 and earlier releases won't know about it:
39
+
40
+ $ perl6-2016.06 -e 'say Instant.from-posix: 1485726595'
41
+ Instant:1485726631
42
+
43
+ $ perl6-2016.07 -e 'say Instant.from-posix: 1485726595'
44
+ Instant:1485726632
45
+
46
+ Since a Rakudo compiler always returns 0 for future leap seconds it doesn't know
47
+ about, you can patch your old code when new leap seconds are announced, so it
48
+ will give correct results, regardless of what version of the compiler it's run on:
49
+
50
+ $ perl6-2016.06 -e 'say ($*VM.version before 2016.07 ?? 1 !! 0) + Instant.from-posix: 1485726595'
51
+ Instant:1485726632
52
+
53
+ $ perl6-2016.07 -e 'say ($*VM.version before 2016.07 ?? 1 !! 0) + Instant.from-posix: 1485726595'
54
+ Instant:1485726632
55
+
34
56
= head2 method to-posix
35
57
36
58
method to-posix()
You can’t perform that action at this time.
0 commit comments