summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 23:11:00 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 23:11:00 +0000
commita1d19d7439593f3bca7a0b4b8cc3be442a3c1272 (patch)
treec5283d114b189c1b49e360ec6f4c826a0c698dcf /ppapi/proxy
parent5d0e7c20c442eb9c375b9dfd74c267f0ed90f04c (diff)
downloadchromium_src-a1d19d7439593f3bca7a0b4b8cc3be442a3c1272.zip
chromium_src-a1d19d7439593f3bca7a0b4b8cc3be442a3c1272.tar.gz
chromium_src-a1d19d7439593f3bca7a0b4b8cc3be442a3c1272.tar.bz2
Add a function to the Flash interface to get the current time zone offset.
TEST=manual BUG=none Review URL: http://codereview.chromium.org/6881059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index 6e3fcd6..83c9b63 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/time.h"
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_resource.h"
@@ -127,6 +128,22 @@ void QuitMessageLoop(PP_Instance instance) {
INTERFACE_ID_PPB_FLASH, instance));
}
+double GetLocalTimeZoneOffset(PP_Time t) {
+ // Somewhat horrible: Explode it to local time and then unexplode it as if
+ // it were UTC. Also explode it to UTC and unexplode it (this avoids
+ // mismatching rounding or lack thereof). The time zone offset is their
+ // difference.
+ //
+ // TODO(brettw) this is duplicated in ppb_flash_impl.cc, unify these!
+ base::Time cur = base::Time::FromDoubleT(t);
+ base::Time::Exploded exploded;
+ cur.LocalExplode(&exploded);
+ base::Time adj_time = base::Time::FromUTCExploded(exploded);
+ cur.UTCExplode(&exploded);
+ cur = base::Time::FromUTCExploded(exploded);
+ return (adj_time - cur).InSecondsF();
+}
+
const PPB_Flash flash_interface = {
&SetInstanceAlwaysOnTop,
&DrawGlyphs,
@@ -134,6 +151,7 @@ const PPB_Flash flash_interface = {
&Navigate,
&RunMessageLoop,
&QuitMessageLoop,
+ &GetLocalTimeZoneOffset
};
InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher,