Flutter Engine
The Flutter Engine
third_party
dart-lang
sdk
runtime
lib
date.cc
Go to the documentation of this 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
3
// BSD-style license that can be found in the LICENSE file.
4
5
#include <time.h>
6
7
#include "
vm/bootstrap_natives.h
"
8
9
#include "
vm/native_entry.h
"
10
#include "
vm/object.h
"
11
#include "
vm/os.h
"
12
13
namespace
dart
{
14
15
static
int64_t
kMaxAllowedSeconds
=
kMaxInt32
;
16
17
DEFINE_NATIVE_ENTRY
(DateTime_timeZoneName, 0, 1) {
18
GET_NON_NULL_NATIVE_ARGUMENT
(
Integer
, dart_seconds,
19
arguments->NativeArgAt(0));
20
int64_t seconds = dart_seconds.AsInt64Value();
21
if
(llabs(seconds) >
kMaxAllowedSeconds
) {
22
Exceptions::ThrowArgumentError
(dart_seconds);
23
}
24
const
char
*
name
=
OS::GetTimeZoneName
(seconds);
25
return
String::New
(
name
);
26
}
27
28
DEFINE_NATIVE_ENTRY
(DateTime_timeZoneOffsetInSeconds, 0, 1) {
29
GET_NON_NULL_NATIVE_ARGUMENT
(
Integer
, dart_seconds,
30
arguments->NativeArgAt(0));
31
int64_t seconds = dart_seconds.AsInt64Value();
32
if
(llabs(seconds) >
kMaxAllowedSeconds
) {
33
Exceptions::ThrowArgumentError
(dart_seconds);
34
}
35
int
offset
=
OS::GetTimeZoneOffsetInSeconds
(seconds);
36
return
Integer::New
(
offset
);
37
}
38
39
DEFINE_NATIVE_ENTRY
(DateTime_currentTimeMicros, 0, 0) {
40
return
Integer::New
(
OS::GetCurrentTimeMicros
());
41
}
42
43
}
// namespace dart
bootstrap_natives.h
dart::Exceptions::ThrowArgumentError
static DART_NORETURN void ThrowArgumentError(const Instance &arg)
Definition:
exceptions.cc:1082
dart::Integer
Definition:
object.h:9909
dart::Integer::New
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
Definition:
object.cc:22984
dart::OS::GetTimeZoneName
static const char * GetTimeZoneName(int64_t seconds_since_epoch)
dart::OS::GetCurrentTimeMicros
static int64_t GetCurrentTimeMicros()
dart::OS::GetTimeZoneOffsetInSeconds
static int GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch)
dart::String::New
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition:
object.cc:23698
dart
Definition:
dart_vm.cc:33
dart::name
const char *const name
Definition:
method_recognizer.cc:309
dart::kMaxInt32
constexpr int32_t kMaxInt32
Definition:
globals.h:483
dart::DEFINE_NATIVE_ENTRY
DEFINE_NATIVE_ENTRY(List_allocate, 0, 2)
Definition:
array.cc:13
dart::kMaxAllowedSeconds
static int64_t kMaxAllowedSeconds
Definition:
date.cc:15
native_entry.h
GET_NON_NULL_NATIVE_ARGUMENT
#define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value)
Definition:
native_entry.h:74
object.h
os.h
offset
SeparatedVector2 offset
Definition:
stroke_path_geometry.cc:311
Generated on Sun Jun 23 2024 21:55:24 for Flutter Engine by
1.9.4