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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/lib/mockimpl.dart ('k') | runtime/lib/date.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <time.h> 5 #include <time.h>
6 6
7 #include "vm/bootstrap_natives.h" 7 #include "vm/bootstrap_natives.h"
8 8
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/native_entry.h" 10 #include "vm/native_entry.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 bool succeeded = BrokenDownToSecondsSinceEpoch(broken_down, 132 bool succeeded = BrokenDownToSecondsSinceEpoch(broken_down,
133 dart_is_utc.value(), 133 dart_is_utc.value(),
134 &value); 134 &value);
135 if (!succeeded) { 135 if (!succeeded) {
136 UNIMPLEMENTED(); 136 UNIMPLEMENTED();
137 } 137 }
138 arguments->SetReturn(Integer::Handle(Integer::New(value))); 138 arguments->SetReturn(Integer::Handle(Integer::New(value)));
139 } 139 }
140 140
141 141
142 DEFINE_NATIVE_ENTRY(DateNatives_timeZoneName, 1) {
143 GET_NATIVE_ARGUMENT(Integer, dart_seconds, arguments->At(0));
144 int64_t seconds = dart_seconds.AsInt64Value();
145 const char* name;
146 bool succeeded = OS::GetTimeZoneName(seconds, &name);
147 if (!succeeded) {
148 UNIMPLEMENTED();
149 }
150 const String& dart_name = String::Handle(String::New(name));
151 arguments->SetReturn(dart_name);
152 }
153
154
155 DEFINE_NATIVE_ENTRY(DateNatives_timeZoneOffsetInSeconds, 1) {
156 GET_NATIVE_ARGUMENT(Integer, dart_seconds, arguments->At(0));
157 int64_t seconds = dart_seconds.AsInt64Value();
158 int offset;
159 bool succeeded = OS::GetTimeZoneOffsetInSeconds(seconds, &offset);
160 if (!succeeded) {
161 UNIMPLEMENTED();
162 }
163 const Integer& dart_offset = Integer::Handle(Integer::New(offset));
164 arguments->SetReturn(dart_offset);
165 }
166
167
142 DEFINE_NATIVE_ENTRY(DateNatives_currentTimeMillis, 0) { 168 DEFINE_NATIVE_ENTRY(DateNatives_currentTimeMillis, 0) {
143 const Integer& time = Integer::Handle( 169 const Integer& time = Integer::Handle(
144 Integer::New(OS::GetCurrentTimeMillis())); 170 Integer::New(OS::GetCurrentTimeMillis()));
145 arguments->SetReturn(time); 171 arguments->SetReturn(time);
146 } 172 }
147 173
148 174
149 DEFINE_NATIVE_ENTRY(DateNatives_getYear, 2) { 175 DEFINE_NATIVE_ENTRY(DateNatives_getYear, 2) {
150 GET_NATIVE_ARGUMENT(Integer, dart_seconds, arguments->At(0)); 176 GET_NATIVE_ARGUMENT(Integer, dart_seconds, arguments->At(0));
151 GET_NATIVE_ARGUMENT(Bool, dart_is_utc, arguments->At(1)); 177 GET_NATIVE_ARGUMENT(Bool, dart_is_utc, arguments->At(1));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 bool succeeded = 249 bool succeeded =
224 BreakDownSecondsSinceEpoch(dart_seconds, dart_is_utc, &broken_down); 250 BreakDownSecondsSinceEpoch(dart_seconds, dart_is_utc, &broken_down);
225 if (!succeeded) { 251 if (!succeeded) {
226 UNIMPLEMENTED(); 252 UNIMPLEMENTED();
227 } 253 }
228 const Smi& result = Smi::Handle(Smi::New(broken_down.seconds)); 254 const Smi& result = Smi::Handle(Smi::New(broken_down.seconds));
229 arguments->SetReturn(result); 255 arguments->SetReturn(result);
230 } 256 }
231 257
232 } // namespace dart 258 } // namespace dart
OLDNEW
« 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