diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-19 23:11:00 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-19 23:11:00 +0000 |
commit | a1d19d7439593f3bca7a0b4b8cc3be442a3c1272 (patch) | |
tree | c5283d114b189c1b49e360ec6f4c826a0c698dcf /webkit/plugins | |
parent | 5d0e7c20c442eb9c375b9dfd74c267f0ed90f04c (diff) | |
download | chromium_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 'webkit/plugins')
-rw-r--r-- | webkit/plugins/ppapi/ppb_flash_impl.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc index 27415e5..db9be46 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_impl.cc @@ -7,6 +7,7 @@ #include <string> #include "base/message_loop.h" +#include "base/time.h" #include "googleurl/src/gurl.h" #include "ppapi/c/private/ppb_flash.h" #include "webkit/plugins/ppapi/common.h" @@ -72,6 +73,22 @@ void QuitMessageLoop(PP_Instance instance) { MessageLoop::current()->QuitNow(); } +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_proxy.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 ppb_flash = { &SetInstanceAlwaysOnTop, &PPB_Flash_Impl::DrawGlyphs, @@ -79,6 +96,7 @@ const PPB_Flash ppb_flash = { &Navigate, &RunMessageLoop, &QuitMessageLoop, + &GetLocalTimeZoneOffset }; } // namespace |