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

Side by Side Diff: runtime/lib/date.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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
« no previous file with comments | « runtime/lib/bool.cc ('k') | runtime/lib/developer.cc » ('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/native_entry.h" 9 #include "vm/native_entry.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
11 #include "vm/os.h" 11 #include "vm/os.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 static int64_t kMaxAllowedSeconds = kMaxInt32; 15 static int64_t kMaxAllowedSeconds = kMaxInt32;
16 16
17 DEFINE_NATIVE_ENTRY(DateTime_timeZoneName, 1) { 17 DEFINE_NATIVE_ENTRY(DateTime_timeZoneName, 1) {
18 GET_NON_NULL_NATIVE_ARGUMENT(Integer, dart_seconds, 18 GET_NON_NULL_NATIVE_ARGUMENT(Integer, dart_seconds,
19 arguments->NativeArgAt(0)); 19 arguments->NativeArgAt(0));
20 int64_t seconds = dart_seconds.AsInt64Value(); 20 int64_t seconds = dart_seconds.AsInt64Value();
21 if (llabs(seconds) > kMaxAllowedSeconds) { 21 if (llabs(seconds) > kMaxAllowedSeconds) {
22 Exceptions::ThrowArgumentError(dart_seconds); 22 Exceptions::ThrowArgumentError(dart_seconds);
23 } 23 }
24 const char* name = OS::GetTimeZoneName(seconds); 24 const char* name = OS::GetTimeZoneName(seconds);
25 return String::New(name); 25 return String::New(name);
26 } 26 }
27 27
28
29 DEFINE_NATIVE_ENTRY(DateTime_timeZoneOffsetInSeconds, 1) { 28 DEFINE_NATIVE_ENTRY(DateTime_timeZoneOffsetInSeconds, 1) {
30 GET_NON_NULL_NATIVE_ARGUMENT(Integer, dart_seconds, 29 GET_NON_NULL_NATIVE_ARGUMENT(Integer, dart_seconds,
31 arguments->NativeArgAt(0)); 30 arguments->NativeArgAt(0));
32 int64_t seconds = dart_seconds.AsInt64Value(); 31 int64_t seconds = dart_seconds.AsInt64Value();
33 if (llabs(seconds) > kMaxAllowedSeconds) { 32 if (llabs(seconds) > kMaxAllowedSeconds) {
34 Exceptions::ThrowArgumentError(dart_seconds); 33 Exceptions::ThrowArgumentError(dart_seconds);
35 } 34 }
36 int offset = OS::GetTimeZoneOffsetInSeconds(seconds); 35 int offset = OS::GetTimeZoneOffsetInSeconds(seconds);
37 return Integer::New(offset); 36 return Integer::New(offset);
38 } 37 }
39 38
40
41 DEFINE_NATIVE_ENTRY(DateTime_localTimeZoneAdjustmentInSeconds, 0) { 39 DEFINE_NATIVE_ENTRY(DateTime_localTimeZoneAdjustmentInSeconds, 0) {
42 int adjustment = OS::GetLocalTimeZoneAdjustmentInSeconds(); 40 int adjustment = OS::GetLocalTimeZoneAdjustmentInSeconds();
43 return Integer::New(adjustment); 41 return Integer::New(adjustment);
44 } 42 }
45 43
46
47 DEFINE_NATIVE_ENTRY(DateTime_currentTimeMicros, 0) { 44 DEFINE_NATIVE_ENTRY(DateTime_currentTimeMicros, 0) {
48 return Integer::New(OS::GetCurrentTimeMicros()); 45 return Integer::New(OS::GetCurrentTimeMicros());
49 } 46 }
50 47
51 } // namespace dart 48 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/bool.cc ('k') | runtime/lib/developer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698