From 65a9538ec79d1dcd1d903e38599d53f29676f39b Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Fri, 29 Sep 2006 08:55:05 +0000 Subject: Bug 351178: WebService needs to be able to provide the server's timezone Patch By Max Kanat-Alexander r=wurblzap, a=myk --- Bugzilla/WebService.pm | 30 +++++++++++++++++++++++++++ Bugzilla/WebService/Bugzilla.pm | 46 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-) (limited to 'Bugzilla') diff --git a/Bugzilla/WebService.pm b/Bugzilla/WebService.pm index 9e100c12a..edb3bd1f9 100755 --- a/Bugzilla/WebService.pm +++ b/Bugzilla/WebService.pm @@ -45,3 +45,33 @@ sub make_response { } 1; + +__END__ + +=head1 NAME + +Bugzilla::WebSerice - The Web Service interface to Bugzilla + +=head1 DESCRIPTION + +This is the standard API for external programs that want to interact +with Bugzilla. It provides various methods in various modules. + +=head1 STABLE, EXPERIMENTAL, and UNSTABLE + +Methods are marked B if you can expect their parameters and +return values not to change between versions of Bugzilla. You are +best off always using methods marked B. We may add parameters +and additional items to the return values, but your old code will +always continue to work with any new changes we make. If we ever break +a B interface, we'll post a big notice in the Release Notes, +and it will only happen during a major new release. + +Methods (or parts of methods) are marked B if +we I they will be stable, but there's a slight chance that +small parts will change in the future. + +Certain parts of a method's description may be marked as B, +in which case those parts are not guaranteed to stay the same between +Bugzilla versions. + diff --git a/Bugzilla/WebService/Bugzilla.pm b/Bugzilla/WebService/Bugzilla.pm index 0caf5fab2..dfab69845 100755 --- a/Bugzilla/WebService/Bugzilla.pm +++ b/Bugzilla/WebService/Bugzilla.pm @@ -13,6 +13,7 @@ # The Original Code is the Bugzilla Bug Tracking System. # # Contributor(s): Marc Schumann +# Max Kanat-Alexander package Bugzilla::WebService::Bugzilla; @@ -20,8 +21,51 @@ use strict; use base qw(Bugzilla::WebService); use Bugzilla::Constants; -sub get_version { +use Time::Zone; + +sub version { return BUGZILLA_VERSION; } +sub timezone { + my $offset = tz_offset(); + $offset = (($offset / 60) / 60) * 100; + $offset = sprintf('%+05d', $offset); + return 'GMT' . $offset; +} + 1; + +__END__ + +=head1 NAME + +Bugzilla::WebService::Bugzilla - Global functions for the webservice interface. + +=head1 SYNOPSIS + + my $version = Bugzilla.version; + my $tz = Bugzilla.timezone; + +=head1 DESCRIPTION + +This provides functions that tell you about Bugzilla in general. + +=head1 METHODS + +See L for a description of what B, B, +and B mean. + +=over + +=item C + +Returns the current version of Bugzilla, as a string. + +=item C + +Returns the timezone of the server Bugzilla is running on, in GMT(+/-)XXXX +format. This is important because all dates/times that the webservice +interface returns will be in this timezone. + +=back -- cgit v1.2.3-24-g4f1b