Skip to content

Commit 6843510

Browse files
committed
Clearify our timezone offsets are in seconds
Fixes #1446
1 parent 52fd65b commit 6843510

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

doc/Language/variables.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ X<|$*SPEC>X<|$*TMPDIR>X<|$*THREAD>X<|$*SCHEDULER>
10851085
------------------+--------------------------------------------
10861086
$*REPO | A variable holding information about modules installed/loaded
10871087
------------------+--------------------------------------------
1088-
$*TZ | The system's local timezone.
1088+
$*TZ | The system's local timezone offset, as the number of B<seconds> from GMT
10891089
------------------+--------------------------------------------
10901090
$*CWD | The Current Working Directory.
10911091
------------------+--------------------------------------------

doc/Type/DateTime.pod6

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ L<X::DateTime::TimezoneClash> is thrown.
9999
100100
Defined as:
101101
102-
method now(:$timezone=$*TZ, :&formatter --> DateTime:D)
102+
method now(:$timezone = $*TZ, :&formatter --> DateTime:D)
103103
104-
Creates a new C<DateTime> object from the current system time, optionally with
105-
a different timezone than the default attached.
104+
Creates a new C<DateTime> object from the current system time. A custom
105+
L<formatter> and L<timezone> can be provided. The C<:$timezone> is
106+
the offset B<in seconds> from L<GTM|https://en.wikipedia.org/wiki/Greenwich_Mean_Time>
107+
and defaults to the value of L«C<$*TZ> variable|/language/variables#index-entry-%24*TZ».
106108
107109
say DateTime.now;
108110
@@ -183,7 +185,7 @@ Defined as:
183185
184186
method timezone(DateTime:D: --> Int:D)
185187
186-
Returns the time zone in seconds as an offset from UTC.
188+
Returns the time zone B<in seconds> as an offset from UTC.
187189
188190
say DateTime.new('2015-12-24T12:23:00+0200').timezone; # OUTPUT: «7200␤»
189191
@@ -193,7 +195,7 @@ Defined as:
193195
194196
method offset(DateTime:D: --> Int:D)
195197
196-
Returns the time zone in seconds as an offset from UTC. This is an alias for
198+
Returns the time zone B<in seconds> as an offset from UTC. This is an alias for
197199
L<#method timezone>.
198200
199201
say DateTime.new('2015-12-24T12:23:00+0200').offset; # OUTPUT: «7200␤»
@@ -353,7 +355,8 @@ Defined as:
353355
354356
method in-timezone(DateTime:D: $timezone = 0 --> DateTime:D)
355357
356-
Returns a DateTime object for the same time, but in the specified time zone.
358+
Returns a DateTime object for the same time, but in the specified C<$timezone>, which is
359+
the offset B<in seconds> from L<GMT|https://en.wikipedia.org/wiki/Greenwich_Mean_Time>.
357360
358361
say DateTime.new('2015-12-24T12:23:00Z').in-timezone(3600 + 1800); # OUTPUT: «2015-12-24T13:53:00+0130␤»
359362
@@ -364,7 +367,7 @@ Defined as:
364367
method local(DateTime:D: --> DateTime:D)
365368
366369
Returns a DateTime object for the same time, but in the local time zone
367-
(C<$*TZ>).
370+
(L«C<$*TZ>|/language/variables#index-entry-%24*TZ»).
368371
369372
my $*TZ = -3600;
370373
say DateTime.new('2015-12-24T12:23:00+0200').local; # OUTPUT: «2015-12-24T09:23:00-0100␤»

0 commit comments

Comments
 (0)