Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(917)

Unified Diff: runtime/lib/date.cc

Issue 10417009: Reapply "Add support for timezone offset and timezone name." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add missing semicolon. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/lib/mockimpl.dart ('k') | runtime/lib/date.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/date.cc
diff --git a/runtime/lib/date.cc b/runtime/lib/date.cc
index 90158c9a345475fcf072595be66597ccd2079842..0c49e5b3fa0557e2e4d7d7e8d8d3891770cd54bb 100644
--- a/runtime/lib/date.cc
+++ b/runtime/lib/date.cc
@@ -139,6 +139,32 @@ DEFINE_NATIVE_ENTRY(DateNatives_brokenDownToSecondsSinceEpoch, 7) {
}
+DEFINE_NATIVE_ENTRY(DateNatives_timeZoneName, 1) {
+ GET_NATIVE_ARGUMENT(Integer, dart_seconds, arguments->At(0));
+ int64_t seconds = dart_seconds.AsInt64Value();
+ const char* name;
+ bool succeeded = OS::GetTimeZoneName(seconds, &name);
+ if (!succeeded) {
+ UNIMPLEMENTED();
+ }
+ const String& dart_name = String::Handle(String::New(name));
+ arguments->SetReturn(dart_name);
+}
+
+
+DEFINE_NATIVE_ENTRY(DateNatives_timeZoneOffsetInSeconds, 1) {
+ GET_NATIVE_ARGUMENT(Integer, dart_seconds, arguments->At(0));
+ int64_t seconds = dart_seconds.AsInt64Value();
+ int offset;
+ bool succeeded = OS::GetTimeZoneOffsetInSeconds(seconds, &offset);
+ if (!succeeded) {
+ UNIMPLEMENTED();
+ }
+ const Integer& dart_offset = Integer::Handle(Integer::New(offset));
+ arguments->SetReturn(dart_offset);
+}
+
+
DEFINE_NATIVE_ENTRY(DateNatives_currentTimeMillis, 0) {
const Integer& time = Integer::Handle(
Integer::New(OS::GetCurrentTimeMillis()));
« no previous file with comments | « lib/compiler/implementation/lib/mockimpl.dart ('k') | runtime/lib/date.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698