summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Bugzilla.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-03-04 20:31:42 +0100
committerJustin Wood <Callek@gmail.com>2010-03-04 20:31:42 +0100
commitac9090d06e0bd66d4d8c9bd0c99512093aeb279c (patch)
treed5cbec611e9e86e57b2582e91fd9c0cb89103034 /Bugzilla/WebService/Bugzilla.pm
parentb30aeba04609049378374441209f7e808931e198 (diff)
parent9a9405da0b6b5baf8157206d34ba3895fb33b788 (diff)
downloadbugzilla-ac9090d06e0bd66d4d8c9bd0c99512093aeb279c.tar.gz
bugzilla-ac9090d06e0bd66d4d8c9bd0c99512093aeb279c.tar.xz
Bug 545299, XML-RPC WebService should take and return dates and times in UTC. POD
Diffstat (limited to 'Bugzilla/WebService/Bugzilla.pm')
-rw-r--r--Bugzilla/WebService/Bugzilla.pm70
1 files changed, 37 insertions, 33 deletions
diff --git a/Bugzilla/WebService/Bugzilla.pm b/Bugzilla/WebService/Bugzilla.pm
index 6e74900b9..c7bbf7c04 100644
--- a/Bugzilla/WebService/Bugzilla.pm
+++ b/Bugzilla/WebService/Bugzilla.pm
@@ -21,6 +21,7 @@ package Bugzilla::WebService::Bugzilla;
use strict;
use base qw(Bugzilla::WebService);
use Bugzilla::Constants;
+use Bugzilla::Util qw(datetime_from);
use DateTime;
@@ -49,32 +50,27 @@ sub extensions {
sub timezone {
my $self = shift;
- my $offset = Bugzilla->local_timezone->offset_for_datetime(DateTime->now());
- $offset = (($offset / 60) / 60) * 100;
- $offset = sprintf('%+05d', $offset);
- return { timezone => $self->type('string', $offset) };
+ # All Webservices return times in UTC; Use UTC here for backwards compat.
+ return { timezone => $self->type('string', "+0000") };
}
sub time {
my ($self) = @_;
+ # All Webservices return times in UTC; Use UTC here for backwards compat.
+ # Hardcode values where appropriate
my $dbh = Bugzilla->dbh;
my $db_time = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
+ $db_time = datetime_from($db_time, 'UTC');
my $now_utc = DateTime->now();
- my $tz = Bugzilla->local_timezone;
- my $now_local = $now_utc->clone->set_time_zone($tz);
- my $tz_offset = $tz->offset_for_datetime($now_local);
-
return {
db_time => $self->type('dateTime', $db_time),
- web_time => $self->type('dateTime', $now_local),
+ web_time => $self->type('dateTime', $now_utc),
web_time_utc => $self->type('dateTime', $now_utc),
- tz_name => $self->type('string', $tz->name),
- tz_offset => $self->type('string',
- $tz->offset_as_string($tz_offset)),
- tz_short_name => $self->type('string',
- $now_local->time_zone_short_name),
+ tz_name => $self->type('string', 'UTC'),
+ tz_offset => $self->type('string', '+0000'),
+ tz_short_name => $self->type('string', 'UTC'),
};
}
@@ -172,9 +168,7 @@ Use L</time> instead.
=item B<Description>
-Returns the timezone of the server Bugzilla is running on. This is
-important because all dates/times that the webservice interface
-returns will be in this timezone.
+Returns the timezone that Bugzilla expects dates and times in.
=item B<Params> (none)
@@ -183,12 +177,21 @@ returns will be in this timezone.
A hash with a single item, C<timezone>, that is the timezone offset as a
string in (+/-)XXXX (RFC 2822) format.
+=item B<History>
+
+=over
+
+=item As of Bugzilla B<3.6>, the timezone returned is always C<+0000>
+(the UTC timezone).
+
+=back
+
=back
=item C<time>
-B<UNSTABLE>
+B<EXPERIMENTAL>
=over
@@ -207,8 +210,8 @@ A struct with the following items:
=item C<db_time>
-C<dateTime> The current time in Bugzilla's B<local time zone>, according
-to the Bugzilla I<database server>.
+C<dateTime> The current time in UTC, according to the Bugzilla
+I<database server>.
Note that Bugzilla assumes that the database and the webserver are running
in the same time zone. However, if the web server and the database server
@@ -217,8 +220,8 @@ rely on for doing searches and other input to the WebService.
=item C<web_time>
-C<dateTime> This is the current time in Bugzilla's B<local time zone>,
-according to Bugzilla's I<web server>.
+C<dateTime> This is the current time in UTC, according to Bugzilla's
+I<web server>.
This might be different by a second from C<db_time> since this comes from
a different source. If it's any more different than a second, then there is
@@ -227,26 +230,23 @@ rely on the C<db_time>, not the C<web_time>.
=item C<web_time_utc>
-The same as C<web_time>, but in the B<UTC> time zone instead of the local
-time zone.
+Identical to C<web_time>. (Exists only for backwards-compatibility with
+versions of Bugzilla before 3.6.)
=item C<tz_name>
-C<string> The long name of the time zone that the Bugzilla web server is
-in. Will usually look something like: C<America/Los Angeles>
+C<string> The literal string C<UTC>. (Exists only for backwards-compatibility
+with versions of Bugzilla before 3.6.)
=item C<tz_short_name>
-C<string> The "short name" of the time zone that the Bugzilla web server
-is in. This should only be used for display, and not relied on for your
-programs, because different time zones can have the same short name.
-(For example, there are two C<EST>s.)
-
-This will look something like: C<PST>.
+C<string> The literal string C<UTC>. (Exists only for backwards-compatibility
+with versions of Bugzilla before 3.6.)
=item C<tz_offset>
-C<string> The timezone offset as a string in (+/-)XXXX (RFC 2822) format.
+C<string> The literal string C<+0000>. (Exists only for backwards-compatibility
+with versions of Bugzilla before 3.6.)
=back
@@ -256,6 +256,10 @@ C<string> The timezone offset as a string in (+/-)XXXX (RFC 2822) format.
=item Added in Bugzilla B<3.4>.
+=item As of Bugzilla B<3.6>, this method returns all data as though the server
+were in the UTC timezone, instead of returning information in the server's
+local timezone.
+
=back
=back