xref: /aosp_15_r20/libcore/ojluni/src/main/native/jdk_internal_misc_VM.cpp (revision 89a6322812dc8573315e60046e7959c50dad91d4)
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * This code is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 only, as
6  * published by the Free Software Foundation.  The Android Open Source
7  * Project designates this particular file as subject to the "Classpath"
8  * exception as provided by The Android Open Source Project in the LICENSE
9  * file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #include "jni.h"
23 #include "jvm.h"
24 
25 #include <nativehelper/JNIHelp.h>
26 #include <nativehelper/jni_macros.h>
27 
VM_getNanoTimeAdjustment(jlong offsetInSeconds)28 JNIEXPORT jlong JNICALL VM_getNanoTimeAdjustment(jlong offsetInSeconds) {
29     return JVM_GetNanoTimeAdjustment(nullptr, nullptr, offsetInSeconds);
30 }
31 
32 static JNINativeMethod gMethods[] = {
33   CRITICAL_NATIVE_METHOD(VM, getNanoTimeAdjustment, "(J)J"),
34 };
35 
register_jdk_internal_misc_VM(JNIEnv * env)36 void register_jdk_internal_misc_VM(JNIEnv* env) {
37     jniRegisterNativeMethods(env, "jdk/internal/misc/VM", gMethods, NELEM(gMethods));
38 }